During the spring and summer, trees have green leaves because of the chlorophyll within the leaves’ cells. Chlorophyll is a key player in photosynthesis because it traps light energy from the sun, which is then used to produce food for tree growth. Leaves always have many other colored pigments within them (some of the pretty colors we see in the fall), but during the spring and summer, there is so much chlorophyll within the leaves that the green “masks” the other colors.
In the fall, trees prepare for winter. Due to the lack of sunlight during the winter, it is not “energy efficient” for the trees to retain their leaves. With little or no sunlight, they cannot produce food (or produce very little) through photosynthesis so they essentially have no use for their leaves. In anticipation of winter, trees reabsorb nutrients, including chlorophyll, from the leaves. The chlorophyll is broken down and the green color disappears, revealing the orange and yellow pigments. A little more complicated science and the tree drops their leaves. This helps the tree conserve water and energy.
Evergreen trees lose their needles too, just not all at once. New needles grow every year, and needles only live so long (2-5 years). So, older needles will often shed in the fall. It is not as noticeable as deciduous trees however, because there are still likely many green needles remaining on the tree.
Our world and the science behind things is quite amazing, isn’t it?