The sudden transition from egalitarian groups to hierarchical societies that occurred with the origin of agriculture is one of the most striking features of the evolution of human societies. Hierarchy is reflected by the evolution of an asymmetrical distribution of the influence of individuals. Although the benefits to leaders themselves are easily justified, it is still hard to identify the causes for the evolution of exploited followers. However, leaders also play an important role in solving coordination problems, a role which would have been amplified by the increase in group size induced by the advent of agriculture. Can this lead to the emergence of leadership directly from the evolution of traits affecting individual influence in group decisions? This question is yet unanswered mainly because of a lack of a mechanistic model linking individual influence to group productivity. Here we fill this gap by explicitly describing the organization of group by a decision-making process. We have developed an evolutionary model where individuals organize to carry out a collective task that produces surplus resources. These surplus resources then drive a demographic expansion of group size. Our results show that a stable distribution of leaders and followers can emerge from the evolution of traits affecting individual influence in decision making, even in the presence of inequality. In addition, our model highlights the conditions and dynamics underlying the development of hierarchy. In line with theoretical work on the evolutionary origins of leadership, this model contributes to understanding the interactions between individual evolution and social structure.