Dreams seem, for the most part, to be the mind’s way of working through unresolved situations. If there are things that we don’t quite have a handle on – some new circumstance that we’re facing or some old circumstance that hasn’t reached closure, or some perennial source of anxiety – then the brain runs these “virtual reality” simulations as a way of trying out coping strategies.
I remember seeing results of a study in which subjects spent a brief time on an arcade-style skiing simulator, then were sent to bed. Brain scans revealed that they spent their dreams mostly rehearsing the ski simulator moves. The next day, their performance on the simulator was markedly improved.
That’s what we also do with the other kinds of challenges we face: relationships, work/school issues, social stigmas, etc.