When do societies succeed in providing public goods? Previous research suggests that public goods contributions correlate with expectations about cooperation by others among students and other demographic subgroups. However, we lack knowledge about whether the effect of expected cooperation is causal and a general feature of populations. We fielded representative surveys (N = 8,500) in France, Germany, the United Kingdom, and the United States that included a public goods game and a novel between-subjects experiment. The experiment varied expectations about cooperation by others. We find that higher expected cooperation by others causes a significant increase in individual contributions. When classifying contribution schedules, we find that almost 50% of the population employs a conditionally cooperative strategy. These individuals are on average richer, younger, and more educated. Our results help explain the varying success of societal groups in overcoming cooperation problems and assist policymakers in the design of institutions meant to solve social dilemmas.