Melanin is a pigment found throughout the body, including the eyes, brain, hair and skin. There are two main varieties: the rarer pheomelanin -- with a reddish-yellow color -- and the more common eumelanin, which varies from dark brown to black. It primarily functions as an absorber of ultraviolet light, which is beneficial, but it also contributes to melanoma, a deadly form of skin cancer as well.
The exact structure of melanin is not fully understood, but scientists know how it can be synthesized from the amino acid tyrosine. Its main function is scattering UV light, preventing a lot of it from going past the epidermis and farther into the skin. In darker-skinned people with more melanin, the pigment can't be broken down by enzymes, allowing it to remain intact and carry out this function for long periods of time.
Melanin varies dramatically between ethnicities and is measured in volume fraction: the percentage of the epidermis, the outer layer of the skin, taken up by melanin. It ranges from 1 to 3 percent in light-skinned Caucasians to 18 to 43 percent in dark-skinned Africans. The main consequence of this is that dark-skinned people have much lower rates of skin cancer, but also fair-skinned people are much more likely to have persistent sunburn long after exposure to UV rays.
Besides the difference in pigmentation, one important difference is their relation to melanoma. While the presence of eumelanin decreases the risk of cancer, a higher presence of pheomelanin increases the risk of cancer by lowering the skin's ability to absorb damaging UV radiation. Another difference is the method of synthesis -- different intermediates are used in the reaction. The absorption coefficient, or how much light doesn't transmit through a molecule, is higher in eumelanin than in pheomelanin.
Due to the lower amounts of melanin, fair-skinned populations are at a greater risk for skin cancer from UV rays as the protective ozone layer diminishes over time. Cancers are formed from cells damaged by UV rays in the skin, which aren't as easily removed as in darker-skinned people. Pheomelanin has been shown to induce cell death in rats and does mutate some cells after UV exposure, making a minor contribution to cancer growth in the skin.