Clearly numerous animals have a hierarchy - hereditary one. For example, I understand zebras have a pecking order, and must map this hierarchy from highest to first in line and lowest to last in line when traveling, and they can be brutalized for breaking this hierarchy. (Interestingly, they allow looser rules for their young.) (Reference.)
Cows apparently spend inordinate amounts of time with certain other animals, and avoid others still. (Reference.)
My question is: why do animals need the hierarchies and alliances? Because human adults tend to make friends with people based on the kind of people they are.
I would imagine that they may have signals that indicate competing survival strategies (for example, a man with thick, tattoo covered arms vs a man in a tie) and that these likenesses try to propagate at the expense of others by forming alliances using organisms that possess these attributes (very vaguely akin to "the selfish gene.")
Or does it have something to do with advertised fitness? I just have to wonder how grazing animals manage to compete over food. Does it control access to reproduction?