Apart from the obvious “pass the gene” role sex had a crucial role in the modern humans history. At some point, the old chimpanzee-like strategy (an alpha male had sex with any female he wanted and a new leader killed the old leader’s babies) was replaced by more or less monogamous society structure. Thus allowing for the long childhood under the protection of both parents.
There are two competing theories about the modern humans (Homo sapiens) origin: the single origin vs multiregional theory. The mainstream, single origin theory postulates that the modern humans originated in Africa and spread to the other continents. It means that despite our morphological differences such as skin colour we are a single species. This theory is confirmed by successful cross-breeding of humans everywhere – from Australia to North America.
The multiple origin theory postulates that “H. sapiens” is not just one species, but rather a composite, which originated in several places, so different human races have independent origins. While there wasn’t much evidence to support this hypothesis, recent human genomes sequencing shows that, as it often happens in natural sciences, the marginal, multiple origin theory had some merit.
It’s been known for a while that migration of H. sapiens brought it in contact with other, resident Homo species, such as H. heidelbergensis. As we are the only modern Homo species, you know who won. So the question is not who but how.
Given our propensity to kill everything in sight, including our closest surviving relatives, chimpanzees, for a while the prevailing theory was that we killed them all, including “the Northern cousin”, the neanderthal (H. neanderthalis). But the neanderthal genome sequencing brought an interesting discovery: modern European humans have a couple of percent of the same DNA as the extinct species. Neandertals did not vanish without a genetic trace, they crossbred with us.
Discovering new humanoid species, such as Denisovans, allowed us to realise, that “sapiens x neanderthalis” wasn’t the only hybrid”. Apparently, people in South Asia who don’t have neanderthal DNA in their genetic makeup, have DNA of yet another hominid species, denisovan (H.denisovan), instead. The resident African humans, such as pygmies, which stayed put, do not have an admixture of either neanderthal or denisovan, but some other archaic hominid species. So different races are bit different, although nowhere as much as much as the multiple origin theory postulated.The other question of course how did hybridisation happen? In chimpanzees, to prevent excessive crossbreeding young males leave the family group and travel, eventually settling with an unrelated female. This has a parallel in pre-industrial human societies, where males had more freedom to travel. Also, unlike males, “foreign” females were considered non-threatening and even desirable.
Bible: Ezra 9:1-2
…The people of Israel and the priests and the Levites have not separated themselves from the peoples of the lands with their abominations, from the Canaanites, the Hittites, the Perizzites, the Jebusites, the Ammonites, the Moabites, the Egyptians, and the Amorites. For they have taken some of their daughters to be wives for themselves and for their sons, so that the holy race has mixed itself with the peoples of the lands.
I’d like to speculate that prehistoric human males probably didn’t mind shaking up with some neanderthalian or denisovan maidens.