system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How did different races cone to existence if at first we were all of the same race?
gpt
Two main factors - distance, and inbreeding.

For most of prehistory, humans were very nomadic. There was no incentive to settle down in one place until the advent of agriculture, which occured a few times in different places around the world around 10,000-4,000 years ago. Before that, you had to move with the food - once the prey animals moved on and/or the fauna was over-foraged, human groups had to move on to a new area. Over time, distance increased between different human groups. Eventually, several groups uncovered the techniques for agriculture, began settling down, and started the very first civilizations.

With this vast distance between populations, inbreeding was fairly normal. Not brother-sister or parent/grandparent-child, but cousin-cousin was fairly frequent. Today, we often scoff at anecdotes of people like Albert Einstein or Edgar Allen Poe marrying their first cousins. But for most of history, this was a fairly normal practice (and one that tends to avoid the damaging genetics of closer inbreeding). Populations were simply too small and too distant for everyone to be able to mate with someone they weren’t closely related to.

Eventually, this began strongly concentrating certain traits - some of which arose through chance mutation and others which arose by environment. Those populations in Europe developed lighter skin to attain adequate vitamin D, while those in Africa maintained darker skin to protect from excess harmful UV light, and some developed the genes for sickle cell anemia to stave of malaria. Another adaptation, the eye fold characteristic to far northern populations and populations in east Asia, may have been developed to protect the eye from UV light and snow blindness. These differences are very largely superficial - not enough time has transpired for any living human population to diverge into a different species - internal organs and cognitive capabilities have remained the same (although genetics and contagion exposure over time have played a role in epidemiology)

Since these populations were concentrated amongst
 themselves for so long, those traits eventually became definitive in those areas, to the point where such traits can identify ethnicity and ancestral origin.

It wasn’t until about 600-700 years ago that interactions between these previously distant populations became relatively common, and it wasn’t until the past few hundred years that the intermingling of these populations became common (e.g. interracial marriage in the United States was illegal until 1967). 

The globalization of all world populations may introduce something equally revolutionary in our genetic pool in the future - a single, unified ethnicity. Because almost every population has access to almost every other population, traditional ethnic traits will likely converge over time.