The smells in flowers come from special oils that are produced in the petals as the plant grows. When this oil evaporates, which it does very easily, it gives off a fragrance which we can smell.
Various combinations of chemicals in the oils of different flowers result in a variety of fragrances. Some are pleasant, sweet smells, like those of roses, lilacs, and lilies, while others are quite unpleasant. The pelican flower of South America, for example, smells like rotten meat!
Flowers get their red, purple, orange, pink, or yellow colors from the pigments, or coloring matter, in the sap of their cells.
It is both the scents and colors which attract insects and birds, which land on the flower to sip its nectar. In doing so, they help to spread the pollen for new flowers.
Many flowers have the same oil in their leaves, roots, and fruit as they have in their petals, so we can smell the fragrances in those places too!