The map below shows how ethnic groups are distributed in Africa. Defining ethnic groups is an infamously tricky problem, so this study used a very simple method: it simply asked people which group they belonged to.
One interesting thing they discovered was that circumstances changed the way people answered this question. For example, in Somalia, after the famine and civil war, people shifted to defining themselves by smaller sub-tribes -- e.g., calling themselves Issa rather than Dir. (Dir being a larger group which includes several other clans)
But as the article notes, this isn't the main thing driving the tremendous ethnic diversity on this map: instead, the fine grains here were mostly created by terrain which physically isolates one group from another. Linguistic boundaries tend to match it.
This is similar to the structure of Papua New Guinea, which rather famously has over 800 distinct languages, mostly completely unrelated to one another, for a population of 7.3 million people in an area not much bigger than Germany. There too, terrain makes it surprisingly difficult to get from the home of one tribe to the next. This map gives you an idea of what's involved there: http://www.muturzikin.com/cartesoceanie/imagesoceanie/papou1.png
Another interesting comparison comes from this recent article in Foreign Affairs, which tried to draw a map of the "real" political borders of Africa: https://www.foreignaffairs.com/articles/2015-11-08/real-map-africa
The idea here was to use foreign travel advisories to identify regions where governments didn't have effective control. This method is somewhat approximate, but the main thing it shows is that most of the Sahara isn't really part of any government at all; in fact, you could walk from Mauritania to Egypt without once stepping into a place that had a government. (Assuming you somehow survived)
Even within areas which are clearly governed, warfare tends to happen along tribal boundaries. Large-scale wars rarely involve small tribes on their own, of course; instead, tribes align with one another, generally based on some shared property like mutual (often fictive) kinship, shared religion, or shared economic needs. These larger alignments can drive much more long-lasting and difficult wars, such as the perpetual instability in Nigeria between the northern Muslims and the southern Christians, or in Sudan (and now South Sudan) between Muslims, Christians and animists.
This is very similar to the pattern seen in the Middle East, where tribes align along combinations of ethnicity, language, religion, and most of all family relationship.
This leads to complex hierarchies of relationship: Hamas could work with Iran because they're jointly Muslim, even though Hamas was principally Sunni and Arab and Iran is Shi'ite and Persian, because they were both fighting against the Israelis, who are Jews. However, there are lots of Persian Israelis, who thus have long-standing relationships with Persian Iranians, and in fact the countries got along fairly well until a different tribal alliance took over Iran in 1979. And Hamas is wary of Hezbollah, who are Lebanese Shi'ites, and also thus clients of Iran, because Hezbollah is mostly fighting wars against everyone in Lebanon who isn't a Shi'ite, as well as fighting against Israel. So Hamas also works with forces in Egypt, which is Sunni and Arab; except not the Egyptian government, which has an alliance with the Israelis, and so instead they try to work with the (Sunni) Bedouins of the Sinai Peninsula, who are at war with the Egyptians, but who are also closely tied to the Israeli Sunni Bedouins, which are...
Anyway, hopefully you get the picture: each group has a bunch of identifiers, and if two groups have any identifier in common (or can make one up), they can use that as the shared language needed to build an alliance. Sometimes these alliances are for trade, while sometimes they're for the purpose of war against a third group. And these alliances can shift quite easily over time.
This can also be useful in understanding the perspective of these groups on regions such as Europe and the US, since they get interpreted as being tribes as well. As far as most of the world is concerned, the US, Latin America, and Europe are three major tribes in their own right, which are parts of the Protestants, the Catholics, and the generic Christians, respectively. (People's individual beliefs have nothing to do with this: religion is a matter of tribal identity, not faith) Importantly, this means that they're not
part of the family of Abraham, which is one of the largest super-tribal designations commonly used in the Middle East, merging Jews and Muslims, including Persian Muslims even though that makes only limited biological sense. That means that entirely different language is needed when making alliances with the western countries, which is particularly difficult because everyone knows what the Christians think of the Jews and the Muslims, and people remember the Crusaders very
Yes, this is how the world works. Exciting, isn't it?
h/t to +Anne-Marie Clark
for the Foreign Affairs article.