All leaves have evolved to perform one simple job: get energy for the plant to make food. Leaves do this by using the suns light energy and converting it into glucose and producing food. The plant needs this for the same reasons we need food; to grow and repair itself.
Leaves are green due to the chlorophyll in chloroplasts in the leaves which actually convert the light energy. Some plants have bright flowers to attract insect pollinators, whereas others have the anther and stigma outside the plant for it to be carried by the wind or other animals.
Plants have different shaped leaves as they have coped to live in different environments. For example, evergreen trees and cactuses have lots of long, thin, needle-like leaves to reduce the loss of water in their habitats as it is extremely dry. Whereas, plants in wet countries have broader leaves to increase the amount of light energy captured. Plants that flower must also put energy into producing the flower so therefore have broad, but fewer, leaves to catch as much sunlight as possible, without investing too much energy into the leaves. Ground dwelling plants, such as those on the forest floor, have very broad leaves to soak up the little sunlight that actually makes it through the thick canopy.
Plants have evolved like this to catch as much of the suns light energy possible, to make enough food. Different climates, weather patterns, situations and access to the sun shape the way the plant produces its leaves and, in some cases, flowers.