The Monster Manual describes Lair Actions as occurring "On initiative count 20 (losing all ties)..." (p 11).
What does "initiative count 20" mean? I can't find that phrase anywhere in the PHB or in any other context in the MM...
At the beginning of a combat, all participants roll initiative (d20 + Dex). Everyone ends up with a number, and take their turns from highest to lowest. Initiative count 20 (losing all ties) means that lair actions happen after any creature whose total for the initiative roll was 20, and before any creature whose initiative roll was 19.
So, for example, a combat starts.
Bob the Fighter: Dex 20, Dex mod +5, rolls 16 for initiative. His initiative count is 21.
Jim the Rogue: Dex 16, Dex mod +3, rolls 17 for initiative. His initiative count is 20.
Tom the Wizard: Dex 14, Dex mod +2, rolls 17 for initiative. His initiative count is 19.
Ginormous the Ancient Red Dragon: Dex 10, Dex mod +0, rolls 16 for initiative. His initiative count is 16.
Bob's turn happens first, followed by Jim's. Then Ginormous can use his lair action. Then Tom takes his turn, and finally Ginormous takes his.
At the beginning of combat, all combatants roll initiative. The combat round then counts down from highest initiative to lowest. Lair Actions automatically get an initiative "roll" of 20.
Basically, the lair has an autmotic initiative of 20 and that’s where it stays in the turn order. The “losing any ties” means if a player’s initiative is 20, the lair action occurs after the player.