I work in a hotel and yup, we'll tell you it's because of fire regulations and insurance and at least in the UK that's partly why.
For the insurance I believe, though might be wrong, that it doesn't invalidate the insurance as such but it does mean those not officially on the booking are not insured so if anything does happen they've got no redress.
And for the fire, it's not for at the time, no the fire brigade won't take my word for it who's there, staff could be in any room, people get snuck in, people go out and don't come back until the early hours or later hours! Yes we have a list (and have to have by law with contact details) but people give false information or wrong information etc, but it's more to have a starting point to contact people if they then aren't accounted for, or should they find someone unable to identify themselves, a starting point to identify them.
I've done a full evacuation before and people on the list not accounted for - the police then took over trying to contact them - the fire service still searched every area, that's why you have building plans with every area on, so they can. Helpful if you can say you know if someone is definitely in a room, but they don't just take your word for it, that could be disastrous.
More important is getting out when you hear the fire alarm, because yes 9/10 it's a false alarm, but I've had the 1/10 time and it's genuinely scary when people just decide without knowing, that it's a false alarm and don't leave, as annoying as those 9/10 times are, that 1/10 could cost you your life.
But as someone who works in hospitality and relies upon the income the hotel makes, people not paying the right amount can cost people like me hours and maybe even a job if things get bad enough - what's the first thing you think a hotel will cut back on when revenues are down? Staff. Or put up the price to everyone.
Extra people are extra water, electricity, bedding that needs to be washed etc - one or two are expected and sustainable but a lot becomes an issue. It never seems to be seen as a big deal if the hotel loses out, negligible, nothing to worry about - only when the guests are expected to pay for the service they're actually using is suddenly the same amount an issue.
People think it's victimless and a bit of a lark - it's not when you're on the other side of it.