Many species engage in risky cooperative behaviors, which pose a challenge to evolutionary theory: participants take on all the costs of cooperation, yet even non-participants benefit from success in these encounters. So, why participate in these risky behaviors? We address this question using data from spotted hyenas fighting with lions. Lions are much larger, and kill many hyenas, so these fights require cooperative mobbing by hyenas for them to succeed. We identify factors that predict: (1) when hyena groups engage in cooperative fights with lions, (2) which individuals choose to participate, and (3) how the benefits of victory are distributed among cooperators and non-cooperators. We find that cooperative mobbing is more strongly influenced by lower costs (no male lions, more hyenas) than higher benefits (need for food). Individual participation is facilitated by social factors, both over the long term (close kin, social bond strength) and the short term (greeting interactions prior to cooperation). Finally, we find some direct benefits of participation; after cooperation, participants were more likely to feed at contested carcasses than non-participants. Overall, these results suggest that, when animals play dangerous cooperative games, selection favors flexible strategies that are sensitive to dynamic factors emerging over multiple time-scales.