In the 1960's and 1970's the activation-synthesis theory was developed by two scientists; Alan Hobson and Robert McCarley. The activation-synthesis theory is the theory that dreams reflect inputs from brain activation originating in the pons, which the forebrain then attempts to weave into a story. This can also be stated as dreams reflect brain activation in sleep, rather than a repressed unconscious wish. These scientists said that dreams reflect the activated brains attempt to make sense of random and internally generated neural signals during REM sleep. This theory provides that during REM sleep neurotransmitters are sending signals to many places in the brain including the pons, thalamus, forebrain and amygdala. By all these signals running through the brain a dream is then formed. I think this is the most scientific explanation of how dreams are formed. It explains the processes of the brain to form a dream. Most of the other theories about how dreams are formed are just opinions. They have no scientific evidence and can not be falsified by any evidence.
Another article also provides this kind of information on how dreams are formed. It states where the signals are transmitted throughout the brain and what each part of the brain purpose is to form the dream. The link to this page is:
In my opinion this theory is the best explanation of dreams. Although it can never fully tell us why we have certain dreams. It can not tell us why some people have nightmares and others do not. I do not think there will every be and answer to all our questions about dreams.