Say a manager goes out on a medical leave, and an assistant manager fills in. The medical leave gets extended, and gets extended. Assistant manager ends up running the office for a little over a year. Not only does the assistant manager do a good job: overall office performance improves dramatically. Production rates go up, and customer complaints for this particular office fall to an all time low. Staff morale is high.
Then the manager decides that they will not come back. Instead manager decides to formally retire, at which point OHR can finally post the position.
There were 2 assistant managers (not the one who ran the office for a year) who become mighty peeved that do not get the job. The person who ran the office become the new official manager. How can that be? Can't upper management see how superior either one of them is to the guy who got it?
Well, to begin with, the 2 rejected candidates were offered the temporary position, but both rejected it. They didn't want a temporary posting, they wanted a permanent one. Successful guy, in effect, paid his dues and helped out the department when they needed it.
Secondly, Successful Guy proved himself worthy in the best place possible: the actual position. He made great strides, and the staff loves him. You don't destroy what is working.
The 2 rejectees have made a name for themselves as candidates whose opinion of themselves is inflated. Last round of job openings did not go well for them as well. Gee, I wonder why?