Jared Diamond's answer to this question can be found in Chapter 14 of Guns, Germs, and Steel. He argues that as societies become more complex, they develop governments, classes of elites that maintain power through a number of ways. Most, it seems, are kleptocracies, who maintain power by extracting wealth and labor by the people they govern. Obviously, this is not exactly a palatable proposition for the people being governed, so rulers devise on of several ways to stay in power. One is to arm other elites, so as to maintain a monopoly of force. Another is to give out, or redistribute the wealth taken from the people in ways most people will approve of. Still another is to use the wealth to maintain social order and welfare. The final method is to develop an ideology of justification that people will accept. Often, Diamond argues, these ideologies are founded, on some level, on religion. It should be noted that religion did not begin with the development of complex societies, but rather with the development of complex societies, elites were able to standardize and shape existing popular religious practices to the service of power.