It is highly unlikely a party would stumble on the lair only to be overwhelmed by dozens of troglodytes. Well before they reach the lair there would be signs of inhabitants along with chance encounters with patrols, hunting and gathering groups. There should be plenty of warning for the party to take it slow and careful. Or to avoid the main lair altogether.
You have to remember that as a referee you are simulating an entire world for the players. The problem is always what level of detail are you going to do this? Some just gloss it over and dive into encounters and locales, while other referee go blow by blow through the adventurer's day.
Most referees find a typical level at which they are comfortable with but remember not all activities require the same of level. For example if the players are engaged in magical research, I have week zip by with only one or two things happening that is roleplayed. However when the players are in the forest of orcs (or troglodytes) I sometime describe things on a hourly basis. At this time scale they would notice the aforementioned signs of habitation, groups and patrols.
The key to figuring this out is imagining yourself there doing whatever the adventurers are doing. Say to yourself what would they see, what are they doing, is there danger involved. The answers to these questions will allow you to make the best call for the situation.
As for the encounter itself I am a referee that lets the dice fall however it goes. However if they come up with a legit plan generally I assume that it will work given good rolls. That if they are smart enough to account for bad luck (i.e. bad rolls) I go with that as well. I don't try to nitpick the details and look for ways to screw them over. However they go in half cocked and die so be it.
But given that they are only seeing the world through what I say,