Cooperation is widespread in nature, occurring in every taxa on Earth. Nevertheless, the contexts in which cooperation occursand the forms it takesvary widely. In this Review, we outline how cooperation can evolve in nature and the cognition needed to support cooperation in different scenarios. We argue that the cognitively simplest forms of cooperation are those where an organism does not need to individually recognise interaction partners and that do not depend upon individuals keeping track of their partners' actions and making contingent return investments. These simpler cooperative interactions occur most frequently among kin and among interdependent interaction partners and are relatively common in nonhuman species. Conversely, cooperation involving individual recognition of interaction partners and where benefits depend upon contingent responses levy greater cognitive demands and occur in limited nonhuman contexts.