Exposure to ultraviolet light causes melanocytes to produce more melanin yielding a suntan. Why would sun exposure prompt this increased melanin production? In other words, what is the function of a suntan?
Melanin is a pigment that is able to absorb UV that would otherwise have caused harm to our skin
UV is an ionizing radiation which can cause chemical reactions (ie. free radicals) within cells that damage the genetic code, causing local cell damage and increasing the likelihood of inducing cancer. The body adapts to to the intensity of sunlight by producing more melanin to defend against cell damage when needed.
Proximity to the equator directly correlates to the intensity of sunlight (UV included), which is one of the reasons peoples that live near the poles have reduced melanin production (not very adaptive) and near the equator have high melanin production (very adaptive)