I've been attending the Language as Social Coordination: An Evolutionary Perspective conference in Warsaw, Poland. I heard a talk by Konrad Talmont-Kaminski on the Evolution of Religion. Although there have been many approaches to this before (and he has a blog on related themes here), his talk was particularly clear.
First, he drew a distinction between the co-ordination of action between a group of people and the co-ordination of long-term goals. For co-ordination of action (e.g. carrying a heavy load/ sharing food), the discourse must reflect reality. However, for co-ordination of goals, this need not be the case. He gave an example of a hunt. Talking about where to go and plans for herding or trapping should try to reflect the real problem as closely as possible. However, if the hunt becomes long and arduous, some members might give up. Invoking a wrathful god that might motivate people to continue.
In this sense, long-term co-ordination needs to sole the free-rider problem (where a lazy minority who still reap the benefits of the group will eventually destabilise the group and the benefits disappear). You can do this by invoking beliefs in higher powers that punish defectors or reward co-operators. However, evidence against these beliefs might destabilise the group.
The evidence against a belief can come in three forms: Evidence can directly contradict the content of a belief. A belief that there is a Unicorn that follows me around will soon be destabilised. The answer is to make the beliefs invisible, dangerous of far away (the Flying Spaggetti Monster comes to mind).
A belief can also exploit the current methodological context. For example, it's easy to claim the shroud of Turin really does date back to the time of Christ if Carbon Dating hasn't been invented yet.
Finally, a belief can use social context to protect it from destabilisation - for example, you can make the shroud of Turin 'sacred' so that it can't be examined or questioned.
A belief that harnesses all three of these tactics is, in Talmont-Kaminski's terms, 'Superempirical'. That is, you can't disprove it because it resists empirical investigation. This means that religion can be shaped by functionality rather than evidence. This is exactly what you want to achieve social co-ordination of long-term goals.
Talmont-Kaminski also points out that the consequences of defecting should also be Superempirical. For example, going to Heaven or Hell in an afterlife.
In the conference, a commentator pointed out that many nations that have very good co-ordination of social goals (e.g. Sweden) seem to be aethist, while many nations that are very un-coordinated (e.g. Afghanistan) are rife with religious belief. Talmont-Kaminski took this point, but argued that there are now social constructs (banks, government) that can take over the role of co-ordination of goals more effectively.
Talmont-Kaminski has a book coming out soon, a preview chapter can be found here.
Konrad Talmont-Kaminski (2008). In a Mirror, Darkly: Does Superstition Reflect Rationality? Skeptical Inquirer, 32 (4)