Shortly: There are about 3 important genes coding for skin color and we get one of each of those three genes from each of our parents. Lets call the genes A, B, and C.
So every human has two A genes, two B genes and two C genes to make pigmentation in your skin.
So in their cells they will have AA, BB and CC.
Now, if one gene mutates and become less active, you can’t make as much pigment for your skin, and it will get lighter. Maybe it’s one of the A genes which is mutated and becomes an a.
Then your cells will have AaBBCC and you can give both an A and an a to your offspring.
Imagine this happens to the two other genes for skin color.
Suddenly we have 6 possible genes for skin color: A, a, B, b, C, and c. The higher case are good at making color while the lower case are not as good.
Now let humans interbreed and mix and match for generations. The genes for color can be inherited in all kinds of ways. and we’ll end up with these possible combinations:
You still inherit one of each gene from each parent, but depending on the combination of strong and weak color genes, your skin will have very different coloration.
Now, if you live in sunny places it’s more beneficial to have darker skin, as that protects you from the sun. If you live in dark places it’s beneficial to have lighter skin, as you can make more vitamin D.
So some in some areas one skin color becomes the norm, as people of that color are better adapted to the area.
But it’s still the same three genes and they have not moved or been lost or changed the species more than the amount of color placed in the skin cells.
Thanks, Pippi Maria Groving, M.Scient in Biomedicine on quora.com: I used your lovely article for this.