There are many reasons why plants release scents. The main reason being to attract wanted insects to said plant to help with pollination this can also be seen as a way to communicate with insects and maybe humans too – it is another form of language in a way
Looking at the different ways in which plants communicate, it is understood that if a plant is being attacked by a predator such as a insect, then the plants way of call out for help is to release a scent. This then attracts that insects predator to come and eliminate what is hurting the plant.
The scent of a flower is also also called a volatile or GLV (green leaf volatile).
A volatile is built up of a complex mixture of low molecular weight chemical compounds that are then emitted by the flower/plant into the atmosphere. This is an important part of the attracting pollinators. What is most interesting that a flower, although can be identical in shape and colour, no two floral scents are ever the same. This is because of the large diversity of different competitors and pollinators. Scent can be seen as a direct signal from flower to pollinator.
Volatiles that are emitted from flowers can function as both long distance and short distance attractions. This is really important as they ‘play a prominent role in the localization and selection of flowers by insects, especially moth-pollinated flowers, which are detected and visited at night.’
‘Species pollinated by bees and flies have sweet scents, whereas those pollinated by beetles have strong musty, spicy, or fruity odors.’ Full article titled Why Do Flowers Have Scents?