How does Jared Diamond explain in Guns, Germs, and Steel that religion evolves along with increasingly complex societies?
As societies become increasingly complex, they become, to varying degrees, kleptocracies, extracting wealth from their people to their leaders. Diamond observes that the difference between "a kleptocrat and a wise statement" is "one of degree," and that the popularity of elites in these societies is dependent on their ability to justify the appropration of wealth from their peoples. The alternative is to maintain control through repression at the hands of an armed elite. Some rulers maintain popularity by distributing wealth, but historically rulers have turned to, in Diamond's words, constructing an "ideology or religion justifying kleptocracy." People already had spritual beliefs, and because all societies ask their peoples for sacrifices in the form of their liberties, their wealth, or their bodies, many institutionalize these beliefs in such a way as to justify these sacrifices. Religion also, Diamond says, brings two other benefits to the leaders of societies:
First, shared ideology or religion helps solve the problem of how unrelated individuals are to live together without killing each other by providing them with a bond not based on kinship. Second, it gives people a motive, other than genetic self-interest, for sacrificing their lives on behalf of others.
Source: Diamond, Guns, Germs, and Steel, 278.