If religious people do indeed live longer and are indeed happier, as some studies claim to show, then the evolutionary basis and reason for the continued existence of religion in the face of rationality and common sense is self-evident. Humans would have evolved a propensity to become religious because it helps their survival.
The truth may set you free, but you might not be as carefree and happy. It will eat away at you — what hurts you does not necessarily make you stronger.
I would maintain that a healthy (i.e. substantial) amount of denial is therefore genetically heritable, that it allows us to blithely go on (despite reading Beckett) and to ignore the basic sadness and desperation of life. We can live in an illusion — in fact we are genetically predisposed to do so. These illusions can be small — I am just as good at catching game as Bob, my rival, for example — or they can be very large — that death is not the end and that I will be rewarded for my faith and Bob, the apostate, will rot in Hell.
Either way, they allow me to go on, to persevere in the face of unlikely odds or limited chance of success. We have evolved to be less rational that one might think, and to be slightly more delusional and even stupid.
Weimar Reality shows
This was in the 20s. Erwin Lowinsky’s Weisse Maus was a cabaret night that encouraged hopelessly amateur performers to get on stage — dreamy housewives, deluded bank clerks. They were encouraged to make fools of themselves. Sounds familiar.
The Black Cat Cabaret featured theme nights — nude girls in imaginary sacrificial Mayan ceremonies, mock bullfights, and naked novices being humiliated by lesbian nuns — with rituals involving silver crucifixes.
Then came Hitler.