It happens quite often, for the first scenario and I've also done it multiple times.
Best thing to do is book your extra night, then contact the hotel to inform them that you have another booking for the nights before and if they could "combine" them so that you can stay in the same room for the total stay. It's easy to do for them. Even though sometimes, they confirm it's done by email and when I check-in, nobody seems to know what happened.... but worse comes to worse, you just need to change to another room.
Shortening your stay is a different story, like others have said, better call them to ask. If it's not a flex rate, maybe they will be nice enough to get you a credit for a future stay. If it's prepaid, maybe if you ask very nicely, they will credit back one night....