http://www.science20.com/hammock_physicist/survival_stupidest-77846The gist of the article is that stupidity survives in the human race because stupid choices tend to negate the bad consequences of those choices if multiple people make them. If you have two other people in a group with you, and each has the option to make a choice that harms them and you and benefits the other person, and they both choose that option, they effectively negate the harm they do to themselves while doing greater harm to you. In short, it makes it look like the stupid choice is actually the smart one (from a selfish perspective).
The simplest way to put it is that if the majority of the group is stupid (and thus are likely to make stupid choices that harm other members of the group and possibly themselves), the minority who is smart (who are likely to make smart choices that benefit themselves and possibly others) are the ones who end up being harmed the most, while the stupid majority get off lightly. In short, it creates a feedback loop that reinforces stupidity and, in true Pavlovian fashion, causes the smart people to also make stupid choices in order to also get off lightly.
There's a great example involving tennis courts in the article. Basically, the gist of it is that in a group of three people, with two tennis courts available for different amounts of time (45 minutes and 60 minutes), and each person getting to play for 2/3 of the available time if all three select the same tennis court, selecting the court that's available for longer is the smart choice as long as at least one other person also picks it. However, if both others pick the stupid choice, the one who picked the smart choice doesn't get to play at all; the two others
benefit from making the stupid choice because they get to play for more time (45 minutes) than if they'd picked the smart choice (40 minutes).
So how does this apply to religion?
It's actually fairly simple if you consider that stupidity is self-reinforcing, harms people who make smart decisions, and is easily underestimated by those same smart people. Leaving aside the question of whether religious belief itself is stupid, because it's beside the point here, there's a choice between participating in worship services and giving offerings to a community's god, or not. This is a classic example of a choice between stupid and smart alternatives (in terms of personal gain/loss), because there is no proven benefit to worshiping and offering, whereas there is definite harm in doing so (if only the time and money/food lost). All other things being equal, there's no reason to worship and to offer.
However, if the majority of the community are religious, they are likely to make the choice to worship and to offer. A person who refuses to will end up suffering the most harm, because they will be disliked and distrusted by the community, if not simply driven out entirely or killed. In short, even smart people will learn to ape belief in that situation.
It certainly explains why religion has been so prevalent in our society, if nothing else. It takes a country which is secular and where religious belief is neither required or necessary to overcome it.