The social hierarchies observed in natural systems often show a high degree of transitivity. Transitive hierarchies do not only require rank differentiation within pairs of individuals but also a higher level ordering of relations within the group. Several authors have suggested that the formation of linear hierarchies at the group level is an emergent property of individual behavioural rules, referred to as winner and loser effects. Winner and loser effects occur if winners of previous conflicts are more likely to escalate the current conflict, whereas the losers of previous conflicts are less likely to do so. According to this idea, an individual's position in a hierarchy may not necessarily reflect its fighting ability, but may rather result from arbitrary historical asymmetries, in particular the history of victories and defeats. However, if this is the case, it is difficult to explain from an evolutionary perspective why a low ranking individual should accept its subordinate status. Here we present a game theoretical model to investigate whether winner and loser effects giving rise to transitive hierarchies can evolve and under which conditions they are evolutionarily stable. The main version of the model focuses on an extreme case in which there are no intrinsic differences in fighting ability between individuals. The only asymmetries that may arise between individuals are generated by the outcome of previous conflicts. We show that, at evolutionary equilibrium, these asymmetries can be utilized for conventional conflict resolution. Several evolutionarily stable strategies are based on winner and loser effects and these strategies give rise to transitive hierarchies.