Science cannot ultimately explain why some people have near-death experiences. That's not to say that current scientific explanations are incorrect, but NDEs are complex, subjective and emotionally charged.
Further, testing presents major challenges. Scientists can't purposely take someone to the brink of death and then resuscitate them in a lab to test their out-of-body perception. Alternately, there's no test to determine if someone actually visited heaven and met God.
Nevertheless, medical science offers compelling evidence that many aspects of NDEs are physiological and psychological in nature. Scientists have found that the drugs ketamine and PCP can create sensations in users that are nearly identical to many NDEs. In fact, some users think they are actually dying while on the drug [ref].
The mechanism behind some of these strange experiences is in the way our brains process sensory information. What we see as "reality" around us is only the sum of all the sensory information our brain is receiving at any given moment.
When you look at a computer or phone screen, the light from the screen hits your retinas and sends information to the appropriate areas of the brain to interpret the light patterns as something meaningful: in this case, the words you are currently reading.
An even more complex system of nerves and muscle fibers allows your brain to know where your body is in relation to the space around it. Close your eyes and raise your right hand until it is level with the top of your head. How do you know where your hand is without looking at it? This sensory system allows you to know where your hand is even when your eyes are closed.
Trauma Response
Trauma affecting functional areas of the brain, such as the somatosensory and visual cortexes, could cause hallucinations that get interpreted as NDEs.
Imagine that all your senses are malfunctioning. Instead of real sensory input from the world around you, your brain is receiving faulty information, possibly because of drugs, or some form of trauma that is causing your brain to shut down.
What you perceive as a real experience is actually your brain trying to interpret this information. Some have theorized that "neural noise," or an overload of information sent to the brain's visual cortex, creates an image of a bright light that gradually grows larger. The brain may interpret this as moving down a dark tunnel.
The body's spatial sense is prone to malfunction during a near-death experience as well. Again, your brain interprets faulty information about where the body is in relation to the space around it. The result is the sensation of leaving the body and flying around the room.
Combined with other effects of trauma and oxygen deprivation in the brain (a symptom in many near-death situations), this leads to the overall experience of floating into space while looking down at your own body, and then leaving to float down a tunnel.
Coping Mechanism
The peaceful, calm sensation felt during NDEs may be a coping mechanism triggered by increased levels of endorphins produced in the brain during trauma. Many people experience a strange sense of detachment and a lack of emotional response during traumatic events (whether or not they were related to a near-death experience). This is the same effect.
NDEs that include visits to heaven or meetings with God could involve a combination of several factors. Faulty sensory input, oxygen deprivation and endorphin-induced euphoria create a surreal, though realistic, experience.
When the subject recalls the encounter later, it has passed through the filter of his conscious mind. Bizarre experiences that seem unexplainable become spirit beings, other dimensions and conversations with God.
The experiences of people whose out-of-body adventures allow them to see and hear events that their unconscious body shouldn't be able to perceive are more difficult to explain. However, it is plausible that unconscious people can still register sensory cues and prior knowledge and incorporate them into their NDE. Whether this is more plausible than the subject's soul floating out of their body is a matter of personal opinion.
Of course, this only scratches the surface of all the possible explanations for an NDE. This phenomenon seems to offer some hope that death is not necessarily something to be feared, nor is it the end of consciousness.
Even science has a difficult time grasping death: The medical community has struggled with specific definitions for clinical death, organ death and brain death for decades. For every aspect of an NDE, there is at least one scientific explanation for it. And for every scientific explanation, there seem to be five NDE cases that defy it.