In-group bias (also known as in-group favoritism or intergroup bias) is the tendency for humans to be more helpful and positive towards members of their own group over members of an out-group. First observed in the early 1900s, in-group bias occurs due to the typical human behavior of forming groups and group identities. Real life examples of such group identities include ethnicity, political ideologies, religious beliefs, and geographical identities. In-group bias can also be seen in artificial laboratory settings- when participants are randomly separated into arbitrary groups they are more likely to support and help members of their own group over members of the other groups.
Membership in groups can change over time so in-group bias can often be witnessed as having an 'ebb and flow' nature over time. An example would be in an election. Early on, members within one political party typically argue with each other and split into factions supporting different candidates within the same party. They can exhibit stereotypical thinking and negative behaviors towards the other group. But over time, after one candidate is selected to run, typically the members of the party fuse back into one group who supports their party's candidate and their in-group bias shifts towards the opposing party's candidate.
Some theories that explain in-group bias include the Realistic Conflict Theory (RCT), which posits conflict over shared resources is what fosters in-group bias, and Social Identity Theory, which proposes creation of distinct individual identities along with a cultural identity increases the likelihood of this bias.