Petals are used by plants to attract or repel certain pollinators such as bees, wasps, butterflies and beetles. They can also point the pollinators to the nectar of the flower.
The collection of petals surrounding the flower are called the corolla and behind them are often leaves called the sepals. Each flower can be either male, female or hermaphrodite. Male flowers, called staminate flowers, have only stamen and no pistil or stigma. Female flowers, called pistillate flowers, have no stamen but have stigmas and pistils, and hermaphrodite flowers, called complete flowers, have all of the reproductive parts.
There are wind-pollinated plants, such as grasses, but these often have no petals or the petals are small and unremarkable. There is a wide range of different colors in flowers that attract different insects, and they often have patterns to help the pollinators find the nectar.
Pollinators are vital in the reproduction of many different types of plant life, and they are required in order for pollen to be distributed from one plant to another. Because there are so many different flower types, pollinators have favorite flowers and can determine which flowers they wish to pollinate. Pollinators will also guard and pollinate the flowers that they prefer.