When we sleep the thoughts of our subconscious mind becomes loud. If the subconscious mind was deeply worried about an issue then we might see a nightmare when we sleep (See why we dream).
The subconscious mind uses different strategies to motive people to take important actions. One popular strategy is sending a person a nightmare to motivate him to take certain actions using fear. When a person becomes indifferent to his problems nightmares might occur.
When a person ignores solving his important problems his subconscious mind might respond back with a nightmare to stir up his emotions and motivate him to deal with his problems. The nightmare in such a case is is a direct reminder of the issue the person is facing (See why we dream in symbols).
Fears, worries and anxieties can be transformed into nightmares even if a person went to them. If a person got emotionally aroused then went to sleep then those feelings might result in a nightmare (See why we get recurring dreams).
Our hearing ability works very well while we are asleep. Many studies have shown that external inputs from our environment do affect our dreams. If the wrong inputs were received while we were asleep then we might see a nightmare.
Some scientists believe that dreams have the purposes of storing the memories we formed during a certain day in the long term memory. Some of the People who support this theory believe that nightmares happen when the brains fails to process certain memories correctly (See why we dream about people).
One possible cause of a nightmare is eating a lot before going to sleep. When that happens the brain becomes more active and as a result nightmares have a higher possibility of happening.
Some studies have shown that sleeping conditions can affect the dreams we get at night. If a person slept in extreme cold or extreme heat then his dreams might be affected by those factors.
Some drugs can affect our dreams. Some studies have claimed that Antidepressants can increase the chance of getting bad dreams and seeing nightmares.
If a person went to sleep while feeling extremely worried or afraid then the subconscious mind might release some of those fears and worries in the form of a nightmare.
Some scientists believe that sleep deprivation can result in nightmares. According to this theory if a person got deprived of sleeping for a long period of time then he is more likely to see nightmares.
After going through a traumatic event a person becomes more likely to see a nightmare. According to one theory the brain tries to include the traumatic event in the right place in memory and while doing this nightmares might happen.
Nightmares can be a defense mechanism used by the subconscious mind to prevent the person from doing something. If a person is too afraid of working at a new place then the subconscious mind might keep him up with nightmares with the goal of preventing him from going to work the next day.