All a horse really has to do to gain dominance over another horse is win the game of chicken they play. If a horse pins its ears and or kicks and the other horse doesn't back down then generally that other horse will win and remain over the other.
It also has to do with the horse the others trust the most but that mostly goes back to who the other horses think are strongest.
We have one of our pastures which is all geldings that has a weird line up. One horse is over every other horse except 1 and that horse is under almost every other horse out there. The reason why is because the one over everyone backed down one or more times from that one but never has from the others where the 1 that is inferrior to most of the others backed off of everyone else but the 1 who is on top of the others.
Its a crazy dynamic for us as humans but that's because we aren't prey animals. Its not the strongest horse that is on top but ultimately the bravest and one with the best instincts.