There are a lot of ideas, theories, and half-fulfilled explanations about how holodecks and holosuites actually work, but one explanation from a user on scifi.stackexchange.com summed it up perfectly “…the reality is that certain aspects of the technology are genuinely nonsensical; sci-fantasy rather than sci-fi.”
There’s a lot of people going on and on about force fields, split perceptions, etc but the reality is holodecks/suites couldn’t work. Not in any reality could holodecks, as shown in Star Trek, actually work. Give me all the jibber-jabber you want, but the idea that the holodeck can sustain a dozen-odd people plus, and run simulations that appear to be four, five, or even 10 times the size of the room itself while allowing people to move around seamlessly and not running into walls or each other is nonsensical. It makes no sense.
It was always supposed to be a plot device, not something that can actually be explained away. After all, how does the entranceway for the holodeck appear in the middle of the room in Star Trek Generations? It makes no sense.
Obviously, they were put into the show and films to help add an element of storytelling. It’s very easy to just change the entire dynamic of the series episode with one single holo-program. For the Next Generation series, it was always the old-timey tales of Robin Hood, ship-to-ship warfare on the high seas, and even Sherlock Holmes.
For Deep Space Nine it was mostly the Las Vegas-like lounge with Vic Fontaine. Then of course there was the baseball game where Captain Ben Sisko and the DS9 crew took on the Vulcans; talk about game-breaking reality.
Of course for Voyager, it was usually Captain Proton or the beach resort that was used a few times.
While they are frustrating to try to understand, they do allow for easy story devices to spring out of them. That said, it wouldn’t have been hard to just re-write every holodeck episode into an “alien world” episode instead.