The other day, I saw an article at ScienceDaily (Apr. 2, 2012), entitled, "Death Anxiety Increases Atheists' Unconscious Belief in God." According to the article, "New University of Otago research suggests that when non-religious people think about their own death they become more consciously skeptical about religion, but unconsciously grow more receptive to religious belief." This is just one more in a growing number of research papers, books, articles, etc. that point out the correlation between religion and the fear of death.
Now consider this, at some point in our evolution as we became more cognitively developed, we arrived at the point where we were imaginative enough to contemplate our own impending deaths, and, this is only speculation, it is possible that the religious impulse was evolutionarily selected for because it shielded our ancestors from despair, which in turn allowed them to thrive better than those who did not have the religious impulse; in other words, those with the religious impulse, not being hobbled by the despair that accompanies the dread of death, would have been more optimistic and more successful in surviving long enough to spread their DNA than those without the religious impulse. This is just a hypothesis, but not really a new one. Similar hypotheses have been floated in the mainstream. The question remains though whether the fear of death, at least in part, caused a religious impulse to be selected for. And other possible causal explanations need to be considered. Describing the world in terms of gods probably gave our ancestors a way of understanding and explaining the terrifying dread of the unknown, e.g. inexplicable natural disasters. Redefining natural phenomena in terms of capricious anthropomorphic deities that could be appeased through prayer or sacrifice, may have provided our ancestors with an illusory sense of control or hope in an otherwise desperate situation.
We must also consider that those of our ancestors who had the religious impulse may have extirpated their less zealous neighbors. Most people who are not pathological will hesitate to kill their fellow human beings; it grates against the conscience. We are predisposed to feel sympathy for our fellow humans. But if one believes one is serving the will of a higher authority, one's god or gods, then having relinquished responsibility for one's actions to that authority, one might conceivably kill and maim one's fellow humans with a clear conscience, wholly committed to the delusion that one is acting on behalf of a perfectly moral deity.
However, if non-believers were exterminated, and there is plenty of historical precedent for this kind of thing, then how is it that we now have atheists? Perhaps for the same reason that there appear to be same-gender couples in America now when, to all appearances, there were none just 100 years ago. Atheists, not unlike gays, learned how to survive by appearing to be something they were not. Some of our ancestors, seeing their kin being enthusiastically slaughtered by our other more zealous and self-righteously homicidal ancestors, decided to learn the fine art of acting and fast. Atheists were for the most part in the closet for millennia. And if recently there seems to be a glut of atheists, it is likely because the ethical reform brought about by science, technology, and the demands of living in a global community has forced religion to retract its claws and grudgingly tolerate non-believers. Now atheists have the freedom to criticize religion, and atheists should not be afraid to do so because when the religious faithful had the power, they didn't criticize atheists--they burnt them at the stake.