Well, one interesting answer to the survival value of religion (except for the common moral values of religions which are good for a society with a common religion), is that one of the greatest advantages of the human brain is our quest for knowledge and answer to questions like, "what?", "where?", and above all "why?" This is the basis of science and thus civilisation, but it is also the basis of religious belief. If we cannot say why the world exist, we try to figure out answers anyway. Those answers become a religion.