There are thousands of chemicals that are used in perfumes. But many of them can be grouped according to their chemical properties.
One such group is esters. An ester is what you get when you let an alcohol react with certain types of acids (acids that contain oxygen). Esters are the main thing you smell when you sniff fruits and flowers.
The scent of pineapple, for example, is largely due to the molecules allyl hexanoate, butyl butyrate, ethyl butyrate, methyl butyrate, pentyl butyrate, and pentyl hexanoate.
Esters that make up perfumes and sweet fruity flavorings start out with bad smelling organic acids, like butyric acid (which gives rancid butter its odor), acetic acid (which give vinegar its sharp smell), or hexanoic acid, which is also called caproic acid because it is the smell of goats in a barnyard.
These foul smelling acids combine with alcohols like methanol or ethanol (which have almost no odor), or butanol (which has a creamy buttery taste and is used as a flavoring in baked goods).
Hexanoic acid (Caproic acid)
The results are pleasant smelling floral or fruity scents used in perfumes, candies, candles, and desserts.
Another class of chemicals used in perfumes are aldehydes. Cinnamaldehyde gives cinnamon its aroma. Furfural is an aldehyde that smells like almonds. Benzaldehyde is another aldehyde in almond scent. Vanillin is an aldehyde that gives another popular flavoring its aroma.
Alcohols themselves are another group. Geraniol is found in roses, lemon oil, and (of course) in geraniums.
Ketones are another group. Civetone is the main scent molecule in musk oil. Damascone is a ketone in rose scent.
A perfume typically has a hundred or so different chemicals in it, and some have several hundred. There are about ten different odor molecules in jasmine, and between three and a dozen in a rose, depending on the variety.