With a properly issued warrant, the police are allowed to search a home; without one, they normally aren't. The same rule applies to hotels. (Keep in mind, though, that rules can differ somewhat depending on the jurisdiction.)
Officers can't just barge into any hotel room without a warrant, nor can they get past the warrant requirement by asking the hotel's permission to search. Indeed, hotels and motels typically don't have the authority to let the police search the room of a registered guest without a warrant. (Stoner v. State of Cal., 376 U.S. 483 (1964).)
In an Ohio case, for example, a hotel housekeeper entered a room that her records listed as occupied but that appeared to be vacant. (State v. Miller, 77 Ohio App. 3d 305 (1991).) She began to inspect it, and in the process found cocaine. She called the police and gave the responding officer some of the drugs, leaving the rest in the room. Officers later searched the room, finding the remaining cocaine.
The appellate court ruled that, as a product of a search by a citizen, the cocaine the housekeeper gave the officer was admissible in court. But it ordered the suppression of the remaining drugs, finding that the housekeeper's "speculative mistaken belief" that the room was unoccupied didn't supply a legitimate basis for officers to search it. Rather, they should have asked hotel management whether the room was rented, then sought a warrant if necessary. That's because hotel employees typically cannot give valid consent to the search of a rented room unless the occupant has authorized them to.
The rule that hotel personnel can't consent to the search of their patrons' rooms does, of course, have exceptions. For example, if a renter has abandoned the room or stayed beyond the rental period, then the consent of a hotel employee can provide a legitimate basis for a room search.
Another rule, which is an exception for emergencies, can also allow officers to enter homes or hotel rooms without a warrant or anyone's consent. (It and related rules can go by names like "the exigent-circumstances exception" and "the emergency-aid doctrine.") The theory is that the police shouldn't have to wait to get a warrant when there is some crisis that requires their immediate intervention.
An example of this kind of emergency exception is a New Jersey case where the police were responding to a report of an armed robbery at a casino hotel. The Supreme Court of New Jersey determined that the police reasonably believed that a victim might have been incapacitated in a hotel room or that a gunman might have been hiding there. So, the court said, officers were justified in entering and conducting a limited search of the room without a warrant. The handgun in plain view that they saw in the room was therefore admissible in evidence. (State v. Hathaway, 222 N.J. 453 (2015).)