Sequence the world and run them through a clustering algorithm, picking how many clusters you get:
2 clusters: African and non-African
5 clusters: African, European, Asian, PNG/Australian Aboriginal, Native Americans
All the way to:
1 billion clusters: Individual families
When most people think of race they are talking about the number of groups that make clusters of major continents, where there wasn't much gene flow until 1492.
Google PCA ancestry (PC term for race) eg gnomAD:
https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSZ-l...
Self reported race matches genetically determined race at rates in the high 90s.
A way to think about it without clustering etc:
People separated (usually by geography) long enough that they bred mostly amongst themselves, and developed characteristics different than other groups.
Yes, you can walk from Amsterdam to Beijing and see a gradient of people the whole way - but that doesn't mean you can't tell the difference between a Chinese person and a Dutchman.