What makes leaves change colors?

Two things. One is the loss of chlorophyll, which removes the green pigment, and allows the yellow carotenoid pigments to show. The other is the production of anthocyanins, which can be the blues and purples of flowers and fruits, or the dark reds of autumn leaves.

Plants lose their leaves on purpose. When a leaf is damaged by wind or too much sun, or when water and light are harder to come by, such as in a cold autumn, the plant will drop the leaf, and either produce a new leaf or go dormant for the winter.

When a tree is about to lose a leaf, it stops sending nutrients to it, and starts reclaiming some of the useful molecules in the leaf, to be stored or used elsewhere in the plant. Chlorophyll fades away and is not replaced. You can see the effects of this as a banana ripens. The green banana becomes yellow, as the chlorophyll is lost, and the yellow carotenoid pigments show through.

Anthocyanins are produced in some leaves as they prepare to fall. These pigments prevent damage from oxygen as the leaf is starved of nutrients, allowing time for the plant to absorb more useful molecules from the dying leaf. They also may be useful when they fall, since anthocyanins can prevent other plants from growing in the soil under the tree, leaving more resources for the tree in the spring.