When attempting to avoid global warming, individuals often face a social dilemma in which, besides securing future benefits, it is also necessary to reduce the chances of future losses. In this talk, I will resort to game theory and populations of adaptive agents to offer a theoretical analysis of this type of dilemmas, in which the risk of failure plays a central role in individual decisions. I will discuss both deterministic dynamics in large populations, and stochastic social learning dynamics in finite populations. This class of models can be shown to capture some of the essential features discovered in recent key experiments while allowing one to extend in non-trivial ways the experimental conditions to regions of practical interest. Moreover, this approach leads us to identify useful parallels between ecological and socio-economic systems, particularly in what concerns the evolution and self-organization of their institutions. Particularly, our results suggest that global coordination for a common good should be attempted through a polycentric structure of multiple small-scale agreements, in which perception of risk is high and uncertainty in collective goals is minimized. Whenever the perception of risk is low, our results indicate that sanctioning institutions may significantly enhance the chances of coordinating to tame the planet's climate, as long as they are implemented in a bottom-up manner. I will discuss the impact on public goods dilemmas of heterogeneous political networks and wealth inequality, including distribution of wealth representative of existing inequalities among nations. Finally, I will briefly discuss the impact of scientific uncertainty — both in what concerns the collective targets and the time window available for action — on individuals' strategies and polarization of preferences.