These airborne oils combine with other compounds to produce the smell. In moist, forested areas in particular, a common substance is geosmin, a chemical produced by a soil-dwelling bacteria known as actinomycetes. The bacteria secrete the compound when they produce spores, then the force of rain landing on the ground sends these spores up into the air, and the moist air conveys the chemical into our noses.
Back in 1964, a pair of Australian scientists (Isabel Joy Bear and R. G. Thomas) began the scientific study of rain’s aroma in earnest with an article in Nature titled “Nature of Agrillaceous Odor.” In it, they coined the term petrichor to help explain the phenomenon, combining a pair of Greek roots: petra (stone) and ichor (the blood of gods in ancient myth).
In that study and subsequent research, they determined that one of the main causes of this distinctive smell is a blend of oils secreted by some plants during arid periods. When a rainstorm comes after a drought, compounds from the oils—which accumulate over time in dry rocks and soil—are mixed and released into the air. The duo also observed that the oils inhibit seed germination, and speculated that plants produce them to limit competition for scarce water supplies during dry times.
The unique smell of rain actually comes from plant oils, bacteria, and ozone.