Upvote:2
This depends partially on how it was booked (pre-paid or free cancellation) but mostly that's in my experience a matter of negotiation.
Talk to the front desk or the hotel manager. If there is something specifically, that's not to your satisfaction, let them know. Perhaps they can fix it (different room, repair the toilet, etc.). If it can't be fixed, let them know and ask them about their policy. Most reasonable hotels will let you go without no or maybe only one night's charge, if you leave by the official check out time, so they can resell the room for the same day. That's not great for them but often better then 1 star review on tripadvisor. Some hints on how to do this