Most dreams take place during REM sleep, or the rapid eye movement phase. Your muscles are often completely paralyzed during this phase, but your brain is active, sometimes even frantically so, your heart rate and blood pressure are increased, and your adrenaline levels are high. Dreams can happen during other periods of sleep, and some people report having dreams during the early stages of sleep when they are just beginning to drift off. The long, complex dreams that you remember, though, most often happen during REM sleep.
Many people only remember the last dream they had when they wake up. However, it is common to have many dreams during the night. REM periods come in cycles, and while sleep sometimes moves from Stage 1 through REM and then back to Stage 1, at other times you bounce back and forth between deep sleep and REM, and each time you are in REM sleep you are dreaming.
From the physiological perspective, therefore, dreams occur because of the different periods of sleep with their different brainwave lengths. From a psychological perspective, on the other hand, dreams often occur because of unresolved emotions being worked through by the brain. Your subconscious analyzes events that occurred during the day and, if there are emotional problems that have not been resolved through communication or reconciliation with the other person, you are likely to dream about this. Such dreams are likely to focus on the emotions involved to an extent that they may even seem irrational when you remember them upon waking up. However, do not ignore the lessons your brain sends you in this way, because these may easily be insights into the root of the conflict. If you can understand the reasons why you feel the way you do, that can help you resolve the emotional problems you are having.
It is also common to dream about things that you are learning, and if you spent the day in intense study of a completely new skill or topic, you should expect to spend much of your night also dreaming intensely about it, possibly even to the extent that you wake yourself up from thinking so hard. As with emotions, your brain is taking the period of sleep and dreaming to work through the new information it was given, by practicing and by trying to test the limits of the knowledge by making mistakes. You may dream that you simply perform the new task over and over again, but you would be surprised at how tiring such a dream can be when you wake from it. In fact, this is one of the brain’s primary methods of learning and solidifying new information, so when you learn something new it is actually common and normal to feel exhausted and to want a nap. In such a case, take the nap, as it will help you digest the information you learned and understand it better when you wake up.
Dreams are notoriously difficult to remember when you wake up, and you are highly unlikely to remember a dream that you had earlier in the night. In order to make sure that you remember your dreams, keep a dream diary by your bedside so you can jot down notes as soon as you wake up. Writing down your dreams in the present tense can also help you remember them better, so say things like “I am standing in a meadow” rather than “I was standing in a meadow.” If at all possible, do not get up before writing the dreams down. Motion and waking memory are controlled in the same part of the brain, and moving around can actually overwrite the already tenuous memories of the dream (rather like looking away from the Silence). There is nothing connecting dream-consciousness and the long-term memory, and so far we do not know why. Even if you lucid dream, it can be very difficult to remember your dream if you do not write it down immediately. On the other hand, once you write it down, you are far more likely to be able to remember the dream again in the future. This is because the very act of remembering the dream to write it down cements it in your memory – but only the parts that you write down! If you skip a detail in telling the story, that detail will likely be forgotten and lost forever.
While you dream, your brain releases the amino acid glycine onto the neurons that control your spinal cord and therefore your actions. This is what keeps you from thrashing during your dreams the way dogs do. Incidentally, if you are a sleepwalker, it is most likely due to a suppression of this amino acid, though the reason it is being suppressed may be unknown. Stress, however, is known to increase incidences of sleepwalking, and the suppression of glycine during times of stress is a reasonable evolutionary survival tactic, as glycine also prevents you from feeling external stimuli (try lifting the hand of someone who is dreaming and dropping it), and therefore could be a hazard if you are not in a safe environment.
Some experts have theorized that deep sleep (stages 3 and 4) are actually the times when the brain rests but the body sometimes moves, while REM sleep is the time when the body rests and the brain works incredibly hard on resolving problems and solidifying learned knowledge. During the night, your REM cycles begin by being extremely short, sometimes only a minute long, and your deep sleep phase is very long. As the night progresses, your deep sleep phase becomes dramatically shortened, and your REM phase becomes long. As such, curtailing your sleep at night is detrimental to your bodily health, as your body physically gets less of the time when it is completely paralyzed to rest, and your brain does not have the time it needs to work through the issues of the day before so that you can start the next day well.