What is dreaming?: originally appeared on Quora: The best answer to any question. Ask a question, get a great answer. Learn from experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.
Are dreams a doorway into another realm? Our subconscious mind trying to send us messages? Or an artifact of nighttime brain activity?
Recent developments in neuroscience shed light onto why we dream and where the content of dreams comes from.
Neurological Basis of Dreaming
Dreaming can be thought of as a protoconscious state  which occurs mostly during Rapid Eye Movement (REM) sleep, but also during other sleep stages such as stage 4 Slow Wave Sleep (SWS), the deepest sleep stage. Studies have shown that the nature of dreams varies according to the sleep stage in which they occur, with most dreams reported during REM sleep.
[As viewed in this figure], sleep stages occur in cycles (called "bouts") over the course of the night. Dreaming occurs during REM but also during certain deeper stages.
The emerging view in neuroscience is that dreams are related to memory consolidation happening in the brain during sleep. This may include reorganizing and recoding memories in relation to emotional drives as well as transferring memories between brain regions.
During the day, episodic memories (memories for events) are stored in the hippocampus, a region of the brain specialized for long-term memory that learns particularly quickly. At night, memories from this region appear to be transferred to the cerebral cortex, the region specialized for information processing, cognition, and knowledge.  
Studies in animals have found that during sleep, the neural activity of the hippocampus "replays" the events of the day. This replay happens faster than real-time, and sometimes happens in reverse. The activity replay is correlated with neural activity patterns in both the visual cortex (responsible for visual experience) and the prefrontal cortex (responsible for strategy, goals, and planning). The memory replay occurs during REM sleep and dreaming. 
Dreams and the Subconscious
But what about the apparent subconscious content of dreams?
Philosopher Daniel Dennett proposes the Dream Weaving party game: One person, the Dream Guesser is asked to leave the room, and while away, someone will share a dream with the group. When the Dream Guesser returns, their job will be to ask yes/no questions of random people in the group to attempt to reconstruct the plot of the dream.
The secret is that while the Dream Guesser is out of the room, everyone else is told to answer yes/no questions according to a rule (for example, "yes" if the question ends in a vowel, otherwise "no"). When the Dream Guesser returns and the increasingly bizarre yes/no questions ensue, it becomes apparent that the "dream" is being created by the Dream Guesser in response to "random" answers.
Could the bizarreness of dreams come from the brain's attempt to make sense of internal signals generated during memory consolidation, as the "activation-synthesis" model of Alan Hobson (Harvard) suggests?
Dreams and Meaning
The search for meaning in dreams has occupied human beings throughout the ages. The idea that dreams might be a random cacophony of memory fragments seems unsatisfying and unlikely.
Dream interpretation often assumes that dreams are coded in terms of symbols, motivations, and beliefs that are meaningful to the dreamer. This coding is what one would expect if dreams were generated by a systematic review of memory relative to personal life strategy. If we imagine that the memory consolidation process is not random, but instead focuses on conflicts between past experience and biologically determined goals, then it should not be surprising that motivational tensions surface in dream content. 
Regarding the biological evolution of REM sleep and dreaming, emotion theorist Jaak Panksepp (1998) comments that: "People who hold dream experience in great esteem may be correctly affirming the importance of affective information that is encoded through our ancient emotional urges for the proper conduct of our waking activities... the REM system may now allow ancient emotional impulses to be integrated with the newer cognitive skills of the more recently evolved brain waking systems. This could help explain many striking attributes of REM sleep, ranging from its heavy emotional content to its apparent functions of enhancing learning and solidifying memory consolidation." 
Stickgold et al (2001) propose that the emotional features of dreams "reflect an attempt, on the part of the brain, to identify and evaluate novel cortical associations in the light of emotions mediated by limbic structures activated during REM." In other words, the brain is trying to interlink our experiences of the world with our emotional drives. 
So while dream content might not be our subconscious trying to send us messages, the analysis of dreams may reveal the underlying structure of the motivational forces driving our life strategy and choices.
Dreams may also allow the brain to explore hypothetical situations in some abstract way in order to refine action strategies for use in the future. The imagery of dreams may result from the brain's sense-making machinery processing signals generated by internal motivational systems, unconstrained by sensory input. In other words, dream imagery could be one part of the brain trying to make sense of the "internal test patterns" generated by another part of the brain.
 Hobson JA (2009). REM Sleep and dreaming: Toward a theory of protoconsciousness. Nature Reviews Neuroscience.
 Payne JD and Nadel L (2006). Sleep, dreams, and memory consolidation: The role of the stress hormone cortisol. Learning & Memory.
 Rauchs G et al (2005). The relationship between memory systems and sleep stages. J Sleep Research.
 Louie K and Wilson MA (2001). Temporally Structured Replay of Awake Hippocampal Ensemble Activity during Rapid Eye Movement Sleep. Science.
 Reiser MF (2001). The Dream in Contemporary Psychiatry. American Journal of Psychiatry.
 Panksepp J (1998). Affective Neuroscience: The Foundations of Human and Animal Emotions.
 Stickgold R et al (2001). Sleep, Learning, and Dreams: Off-line Memory Reprocessing. Science.