Tribalism is instinctive; it's an innate behavior we are born with. Only afterwards it begins to take different forms we learn from society as we grow up.
Nature taught us to live in groups, and fight, kill and die for those groups. We flock around an alpha male to idolize, or demonize and trample a weakling, when we see others do so. Our body chemistry automatically changes when we move from a solitary mode to a social one, where individuals become no more individuals, merging into one individual. Oxytocin and vasopressin, the social hormones, naturally make us relax, trust and sympathize with those we are more familiar with, than those we are not, to easily mesh together.
Tribalism is more than a herd instinct, imprinted only in Hominids over millennia of evolution and still driving their behavior. It bonds them in groups, for more power, order, and diversity; but it also causes "discrimination" in various forms: sexism, racism, ageism, nepotism, lookism, speciesism, etc., which are but variations on the theme of mindless favoritism. Favoritism is justified only by real differences between people affecting their living and mutual interest, not by looks, race, gender, or personal beliefs and tastes.
Understanding human tribal instinct spares us many irrational acts committed in the name of "love, loyalty, honor, altruism, patriotism, tradition, etiquette and conformity," merely motivated by a compulsive urge needing to be curbed and refined. Those who like to help, live or die for others may reconsider their choice if they clearly see the instinctive motive behind their action.
Dying for someone or to defend a cause is a noble act, but it's optional. Death is not preferred under most circumstances, and those praising human sacrifice (the few for the many, minority for majority, individual for group/sect/family/tribe/state) calling it heroism or martyrdom, might not call it so if they knew it merely comes down to chemistry sometimes (or if they were to die themselves). Nobody promptly seeks death unless they are unconscious of the price they pay, while under the influence of a drug, an obsessive idea, or a mindless instinct driving them to their end: eating, mating, fighting, or bonding tribal instinct.
The Roots of Discrimination
"We follow instinct when we fail to use reason." Following our tribal instinct can lead to discrimination against any group in society we consider different from ours. There are contexts helping such latent instinct bloom and flourish. It's better to avoid those contexts that set the animal in us loose, than blame the former for our "willfully" wrong actions.
There are many forms of tribal behavior, as new forms develop everyday, with new terms "coined." Only recently we could see them vividly and examine them closely, since technology brings more different people together, with conflicting needs and characters. It lets them re-discover and identify themselves differently, which further adds to the complexity and intensity of their conflicts. Following instinct blindly would be risky then; rather, knowledge is needed. "Progress harms only the unwary": while absorbing the aftershocks of technology, it's timely to understand our differences first, to deal with the new challenges.
• Fanaticism: All fanatics, in religion, sport, arts, etc., don't reason with what they are fanatic about, only moving by force of habit and instinct. Gradually, they grow into addicts, losing control over their actions, before the addiction moves to the rest of their being and damages the brain with fanatic extremist beliefs, in individuals and whole "fanatic societies."
• Sexism is common among individuals and entire "patriarchal societies," that lack understanding of gender similarities, which are less visible than gender differences we instinctively respond to like animals. For this too, it's easy to understand why there is discrimination against homosexuals, bisexuals, transgenders ... and disrespect for jobs/sports/arts transcending gender differences. Other than gender misunderstanding, there are other causes of sexism:
• Chauvinism is a form of nation-wide tribalism, or collective dignity: a national self-image every good citizen must protect. It increases for different reasons or variations on the aforementioned causes of discrimination:
Chauvinism can lead whole nations into wars, physical and verbal, taking revenge on one another for nonexistent reasons, where many lives are lost. It leads to discrimination against immigrants/foreigners even when they are harmless or useful. Within the same country, people can also discriminate against those from other country parts.
As virtual and physical communication increase, and borders gradually disappear, traditional patriotism is transforming into a broader meaning, where many choose to identify themselves as Earth citizens, directing their loyalty toward the planet all humans share, and trying to solve the problems affecting all its inhabitants.
Ironically, most of the world's national anthems and songs need revision, as they include parts flagrantly inciting discrimination and violence, while illogically binding individuals to a single place on Earth, away from which they are doomed to suffer, or perish. Suffice it to keep the lines expressing one's gratitude for the good memories in their birthplace and where they grew up. It's the leaders of those nations who enjoy most hearing such songs, because it makes their subjects meeker, hence their ruling easier and longer. Chauvinism is a dumb idol worshiped by dumb worshipers, mostly created by self-interested politicians who need "human sacrifices" from time to time, whenever he—the idol or ruler—is angry, in a bad mood, or in a mood for killing some citizens.