My theory is that it was a stress reliever for ancient man.
It was a way to explain all the things they could not explain and that in momments of strife something to look to feel less alone and a sense that even if you die there is more left.
In feeling that death was not the end people could perform in very stressfull conditions without falling appart. When people feel all is lost they are more likely to sit down an give up.
Certainly not a new theory but I see a few problems with trying to prove religion is a "natural" result of evolution.
1. It first just jumps over an even bigger "event" -the development of a conscience. A conscience doesn't exist in the animal world. Animals kill to eat and do so without remorse, they will kill the young of even their own kind in order to eat -and lose no sleep over it. They will kill even their own kind to compete for mates and territory -again without remorse. They do what they have to do to survive.
So why would man even develop a conscience in the first place? What purpose does it serve the human race? And why is it not seen in animals? Porpoises are very intelligent, pigs are said to be very intelligent. But still without a conscience. And more importantly -we don't EXPECT animals to have a conscience, but we do expect humans to.
And don't tell me that because your dog swiped food off the table and them hung his tail between his legs when scolded, it proves he has a conscience. It only proves a desire to please his master, someone your dog perceives as being dominant over him. If no one is around, that dog will still swipe the food even if it means depriving you of eating. If he has been disciplined enough, he may refrain from doing so even when no one is around. But it only means he has been well trained. It doesn't mean he suddenly developed a conscience.
2. The emergence of religion serves no evolutionary purpose whatsoever. It does not prolong the life of an individual and it does not prolong the life of the species itself. It does not provide more food, more territory or a greater choice in mates -all of which can benefit the species as a whole. But the existence of religion in a culture doesn't do that. Yet it is a universal phenomenon. We see the emergence of religion in totally unrelated peoples and cultures in every known culture and on every continent -most of whom did not have any knowledge of other people and their religions when their own religious beliefs first emerged.
3. The theory of evolution attempts to explain the appearance of life and the diversity of plant and animal life on the planet. Since there is no "religion" spot (or one for conscience or even self-awareness) that physically exists in the brain -where if it exists, the individual has religious beliefs and if it is missing, they don't -evolution cannot possibly explain the emergence of religion, which involves a belief system -or how people THINK. The theory of evolution does not even attempt to explain why people think the way they do -and cannot and never intended to either. People have had half their brains removed in order to alleviate potentially fatal seizure disorders, some the left half and some the right half. No matter which half was removed, the individual ends up no less self-aware, their religious beliefs remained unchanged as does their conscience. If the operation is done as an adult, they suffer the inability to properly control one half of their body, if done as a child under 6, that child only suffers a residual partial vision loss. But in adult or child -whatever makes that individual "him" is unaltered.
4. My own theory is this. Because unrelated societies and cultures developed religion -and did so unrelated to other cultures and their religions -it strongly suggests that people are hardwired for it. There isn't a physical "religion" spot. Just like there isn't a "specific nest building" spot in the brains of bird -but can still only build one kind of nest, so may humans be hardwired for religious beliefs. Built with a desire to seek out their Creator who wanted them to seek Him out. Since the overwhelming majority of all people everywhere in the world believe in a Creator, Supreme Being, God, whatever name they use -and do so at any given time in history including today - it suggests that being an atheist is actually the aberration among the species. Just as sociopaths -people who have no conscience -are also the aberration of the species and not the norm.
And oddly enough, in both cases -the atheist and sociopath -considers themselves superior to the rest of the idiots on the planet.
If there is no God and we are here by pure and meaningless chance, then it has to be the biggest irony in the universe that the highest form of life has spent its entire existence -searching for the meaning of his existence.