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.
Definitely calculate the average damage of the effect to add to CR.
Charm is harder to calculate, so I will link to a good example of monster creation for 5th edition here.
Off the top of my head, a charm effect like the spell would give a DC 15 saving throw to avoid it. I will assume average character can pass this 60% of the time.
Assuming a 4 person party will output 40 damage a round, each extra point of AC on a creature will remove 1/20 of that damage = 2 damage.
Assuming a character will fail a DC 15 wisdom saving throw 30% of the time, this equates to a party damage reduction of 0.3 * 10 damage per round = 3 damage per round. Given the damage to AC equivalency of 2 damage to 1 AC we get the Charm ability equal to an extra 1.5 AC
My assumptions on average damage per round and average DC 15 failure are wrong, most likely, but this illustrates the calculation required at least.
Best Answer
The creature must be present, as it's the one using the actions, not the lair itself
In the Monster Manual, p. 11, under Lair Actions, it says:
(For anyone with an older printing, part of that quote was added in Errata v1.0, December 21, 2015)
From this, it's clear that the creature itself is using the lair action, not the lair itself (especially since it doesn't make any sense for the lair itself to be considered surprised or incapacitated). Therefore, the creature must be present and part of the initiative in order to use the lair actions.