Here are a couple blurbs that will sum it up, although I recommend reading the full article:
And yet people in every culture believe in an afterlife of some kind or, at the very least, are unsure about what happens to the mind at death. My psychological research has led me to believe that these irrational beliefs, rather than resulting from religion or serving to protect us from the terror of inexistence, are an inevitable by-product of self-consciousness. Because we have never experienced a lack of consciousness, we cannot imagine what it will feel like to be dead. In fact, it won’t feel like anything—and therein lies the problem.
I've been thinking along that route for some time now. An afterlife myth is more or less common to every culture (correct me if you know one that is without one). In anthropological terms, that means we may be able to find a prevailing structure in the mind that gives rise to these beliefs.
On the one hand, then, from a very early age, children realize that dead bodies are not coming back to life. On the other hand, also from a very early age, kids endow the dead with ongoing psychological functions. So where do culture and religious teaching come into the mix, if at all?
In fact, exposure to the concept of an afterlife plays a crucial role in enriching and elaborating this natural cognitive stance; it’s sort of like an architectural scaffolding process, whereby culture develops and decorates the innate psychological building blocks of religious belief. The end product can be as ornate or austere as you like, from the headache-inducing reincarnation beliefs of Theravada Buddhists to the man on the street’s “I believe there’s something” brand of philosophy—but it’s made of the same brick and mortar just the same.
There are many ideas that have arisen as similar by-products. Old views that the we on the earth were the center of the universe were handy for our ego-centric minds. Astrology might have been birthed of the mind's incessant need to provide structure and predictability to an otherwise stressed and unstable existence. Marriage is almost certainly a by-product of sexual selection mating behaviors.
Much of Evolutionary Psychology is still fairly young research, I can't wait to see where this all goes.