I do not know what the main causes of brain fog are for everyone, but can write
a bit about what helped get rid of some brain fog, for me.
Some things that have helped me:
Eating a ketogenic food plan. Also, making sure that what I eat is nourishing. I don't eat things that could cause troubles.
Avoiding packaged/processed foods, with all their additives, preservatives and mystery ingredients. The FailSafe diet helped with this.
Avoiding: grains, legumes, nuts/seeds/their oils, nightshades, oxalates, salicylates (except black or brown tea), goitrogens, FODMAPs, sweet fruits.
Following Dr. Richard Bernstein's Law of Small Numbers, which means eating constant amounts of CHO and PRO from breakfast to breakfast, lunch to lunch, and supper to supper, day to day. And, eating small amounts at time. Small meals. This keeps blood sugar normal and stable, for me. Constant blood sugar means clearer thinking. Eating too much protein, at one time, or in one day, makes me feel unwell and out of sorts a bit later.
Taking supplements: magnesium, L-carnitine, CLO with a dab of butter, Vit. D and E, nutritional and brewer's yeast, PicMins minerals, for a few examples.
Drinking tea helps me. Too much tea causes troubles. As with the other things, it takes experimenting to discern how much, how often....
Getting proper rest and sleep.
Doing yoga, Callanetics, rebounding, taking walks. Calming, strengthening, and restorative, for me. Callanetics combines yoga with ballet training. Yoga is known to increase GABA.
Balancing rest and exertion, being alone and being with others, work and play, etc. Easier said than done, I know. :)
Avoiding things/people/situations which are, for me, too much input at once. I don't go to the cinema. I avoid crowds. Don't listen to the radio very much. I like being around folks who are circumspect and value quiet decency. I like being able to hear myself think. :) This aspect of being able to think clearly takes deliberate care nowadays. Before television, every day life was much saner.
Those are the things which come to mind, at the moment. :)
Hope they help someone.