While I understand that everyone has different expectations and everyone runs their game differently and that's perfectly okay... I have to say I'm surprised by most posters' antipathy towards people leaving without some sort of grace period.
I do agree with
@LotsOfChips that leaving
because you are up is a different matter, i.e. it's a sign that winning money is the reason you came, whereas at my games, I'd hope that you came to enjoy the company and the gameplay (where the possibility of winning or losing money is part of the gameplay). But otherwise... I don't care what time you leave, and I don't care how suddenly you do it, even you do it right after cleaning out the rest of the table (as long as that's not
why you're leaving). I have people over to play board games, eat food, drink, and chit-chat - usually bringing their entire families, and many of them not even playing games. I can't imagine someone saying "Welp, it's late, we need to head home" and me responding "Whoa, whoa, why didn't you tell me thirty minutes ago you were going to be leaving?" It's a social gathering, not a command performance.
I do agree with several others that it's courteous to let the host know if you think you'll be leaving significantly earlier than might otherwise be expected, so that the host can have a sense of how the evening is going to go in terms of numbers of players and types of games at various times. But that's bound to be a rough estimate, and needing to either time it down to the minute or provide a fifteen minute warning just seems pointless.
I also get that some people probably feel slighted if you win a bunch of money and then leave without giving them a chance to win it back. But I think that's a terrible attitude to have; once the money's in the pot, you have no claim to it, and once the money's in someone else's hands, it's theirs to do with as they see fit. No one ever owes you a bet; they're entitled to play as loose or as tight as they wish whenever they wish, as long as they pay their blinds and antes. Thinking otherwise is contrary to the fundamental principles of poker and gambling. At least, that's my view, and it's one that I'll try to encourage in my players.
Edit to add: If I'm going to someone
else's game, I'll ask what's expected, and if I didn't ask I'd always err on the side of giving some notice before leaving. Because regardless of how
I feel about the issue, it's always courteous to follow someone
else's rules when you're at
their place.