More than 130,000 people visited the U.S. Botanic Garden in July, many just to see a single flower. The bloom of the titan arum is notable for three things. First, it’s enormous: The flower doubled the height of the plant from four to eight feet. Second, it’s rare: Since it takes so much energy to produce a flower of that size, the bloom was 10 years in the making. Finally, it stinks: The titan arum’s blossom is known as the “corpse flower,” because it reeks of rotting flesh.

For all of our interest in the scents of flowers, few people have bothered to consider how and why flowers give off their aromas. Robert Raguso, a chemical ecologist at Cornell University, and his colleagues have hypothesized several reasons plants give off scents.

The most obvious is attraction. Most animals worry about attracting mates for reproduction. Since flowers are rooted to the ground and have sex from a distance, they must attract pollinators that will transport their reproductive products to nearby flowers. Flowers that best attract pollinators will have an advantage in proliferating their genes. Scents that we consider “floral” tend to attract bees, hummingbirds and other famous pollinators. But not all animals share our aroma preferences. Beetles and flies can act as pollinators, too, and they simply adore the smell of rot and excrement. To each his own.

A second use for floral scents is the opposite: repellence. Not all creatures are pollinators. Some bees punch holes in the backs of flowers, and swarms of ants can easily destroy a plant. Some flowers use offensive odors to keep those dangerous creatures away.

A flower’s scent also acts as a training mechanism, a variation on the attraction theme: Attraction means that the pollinator likes the smell. With the training theory, the pollinator may not have strong feelings about the smell itself, but it learns to link it to nectar.

“Think of scents as olfactory billboards that teach pollinators to associate a certain smell with a good meal,” says Raguso.

Aroma also acts in concert with color to train pollinators. Insects, birds and other pollinators have memories, but they can only hold only so many recollections of individual colors and scents in their minds. Using the two in combination (red plus a honey smell, for example) is a better billboard, more likely to be remembered.

A flower’s smell can also act as a navigational tool. Humans, with only one nose, are pretty bad at this. But bees, for instance, are different. Like many other pollinators, they have several olfactory organs, some on the ends of their antennae. Bees use the slightly different olfactory signals from their two antennae to find their way around. A flower’s scent can direct a pollinator to its exact location.

There’s one more theory to explain the role of floral scents.

Charles Darwin, the father of natural selection, pointed out that some pollinators flit between flowers of different species, increasing the chances that a flower’s reproductive products will go to an unrelated species, producing a hybrid offspring. Hybridization in the plant kingdom has some benefits, such as creating new species, but many hybridized plants are sterile and mark the end of a genetic line.

Scents help prevent this from happening. If a flower can differentiate itself from other species, it is more likely to attract specialized pollinators and maximize contact with others of the same species. If you really like one brand of beer and it has a very distinct flavor, you’re unlikely to buy the competition. The same goes for bees and flowers.

So what causes all the different floral scents? Flowers give off volatile aroma compounds as a result of a process called anabolic synthesis: putting together small molecules to make big ones.

“Isoprene is a very small molecule that’s most famous as a greenhouse gas,” Raguso says. But, “if you condense two isoprene molecules, you get a monoterpene — a 10-carbon molecule that can smell like lemons, lavender or many other things, depending on how the molecules are combined.”

One monoterpene has an alcohol compound in its structure and smells like Earl Grey tea. A molecule with the same formula but without the alcohol smells like a newly manufactured carpet. Two versions of a related substance, essentially mirror images of each other in their chemical structure, smell like spearmint and caraway.

Other aroma compounds are the result of catabolism, the breaking-down of a large molecule into a smaller one. The smell of cut grass, for example, comes from a catabolic process.

Like bees, many people have a favorite flower smell. (Mine’s jasmine.) Few people know more flowers than Raguso, so I asked for his favorite.

“The Rangoon creeper,” he said. “It’s a big woody vine from tropical Asia, with long, tubular flowers that turn from white to pink and eventually scarlet. At the pink stage, they’re the perfect color of watermelon, and would you believe what the flowers smell like? Watermelon Jolly Ranchers.”

If human children could serve as pollinators, the Rangoon creeper would have it made.