For the majority of human history, hunting and gathering was sufficient for feeding and providing for groups of semi-nomadic peoples. With small populations, and with everybody focused on the task of providing food from the environment around them, humans were able to support themselves in these small groups.
Once early agricultural efforts took hold about 12,000 years ago, human populations began to settle permanently in place where they could provide a more reliable food source through farming and animal husbandry. Agriculture involves a division of labor. Therefore societies that had formerly been more egalitarian gave way to ones defined by social hierarchies.
There is no single factor that led to agricultural development. However, conditions of a changing climate, seed and animal domestication, and growing pressures put upon natural food sources led more and more people to gradually shift to a less hectic, agriculturally-based lifestyle.
As farming techniques improved, more and more surplus food was made. Eventually, it was possible for some farmers to create enough food so that not everyone was needed to participate in agriculture. This allowed urban populations to develop. Within these cities, people could engage in all sorts of occupations that would have been unavailable during the hunter-gatherer days, such as trade, manufacturing, civil administration, artistic pursuits, and religious roles. This led to further stratification in society. With food supplied from the nearby countryside and also from far-away places through trade, it became possible for cities to thrive as never before.