It is an example in which religion provides a regulatory framework within which society is controlled. Now if this is "good" in the sense of western political ideology is irrelevant to a discussion as to the evolutionary benefit such a system may have proffered its members with regards to group cohesion.
As time goes on, I become less and less convinced that religion has survived because it has had any benefit in group cohesion. The reason I say this is that it cannot account for atheism and the success of science which obviously do not provide a benefit to survival through group cohesion.
I think that humans developed a fear of the unknown as a survival mechanism. This is the same "flight or fight" response we see in other species. The greatest unknown and therefore the greatest source of fear is what happens after death and unfortunately this fear cannot be dealt with using the fight or flight response available to humans.
So, what tools do humans have to deal with this odd threat? Fear of the unknown can be handled in three ways. One can succumb to the fear which makes living an enjoyable life very difficult, one can pretend to "know" the unknown which alleviates the fear as long as it isn't too obvious that the made up truth is in fact false, and finally, one can actually gain knowledge until the unknown truly becomes known.
This would explain why both religion and science/atheism compete for human converts. They both work when addressing a fear instilled in us through evolution. Each of these systems utilizes a different aspect of what makes us human. One mainly utilizes our highly developed imagination and the other mainly our highly developed intellect, although each uses both to some extent.
Further proof of this, in my opinion, can be seen in the fact that religion has not advanced any major new insights into the matter in many hundreds of years. The imagination based system reached its limit about dealing with the fear long ago but the intellect has not. All knew ideas about the origin of life and answers to the question of death, now come from science.
It is not in the best interest of religion to change to the better knowledge based system. That would be philosophical suicide. The only way religion can compete with science is by aggressively attacking it and pointing to other benefits it supposedly has over the knowledge based system. Things like group cohesion, a sense of community, social networking, etc.
These are
NOT benefits of religion in my view. They are benefits of groups working together for a common goal. As such, there is nothing to stop science/atheism from having the same benefits and we see that it does. Get a group of scientists or atheists together and those benefits are equal to religion. In all other areas science far out shines religion. Those areas are; explaining the origins of life, human behaviour, what happens after death, etc., where religion really has nothing further to add and what it already offers has been falsified.
To conclude. It is my opinion that the only benefit religion ever had was that it alleviated fears inherent in being human. All the rest of the benefits were incidental. Some have been very powerful, such as the ability for people to be controlled through the use of their own imagination, or the sense of community through group worship. However, these things are a result of the human condition, not religion. Religion is just a way to exploit them and not always for the good of the individual. There is nothing stopping science from having these benefits nor from being exploited to the detriment of society. I would just argue that the very nature of science makes the exploitation much less likely while enhancing the benefits greatly.