Microbes produce many molecules that are important for their growth and development, and the exploitation of these secretions by nonproducers has recently become an important paradigm in microbial social evolution. Although the production of these public-goods molecules has been studied intensely, little is known of how the benefits accrued and the costs incurred depend on the quantity of public-goods molecules produced. We focus here on the relationship between the shape of the benefit curve and cellular density, using a model assuming three types of benefit functions: diminishing, accelerating, and sigmoidal (accelerating and then diminishing). We classify the latter two as being synergistic and argue that sigmoidal curves are common in microbial systems. Synergistic benefit curves interact with group sizes to give very different expected evolutionary dynamics. In particular, we show that whether and to what extent microbes evolve to produce public goods depends strongly on group size. We show that synergy can create an "evolutionary trap" that can stymie the establishment and maintenance of cooperation. By allowing density-dependent regulation of production (quorum sensing), we show how this trap may be avoided. We discuss the implications of our results on experimental design.