Stalemate happens when it's a player's turn, there is no legal move for them, and their king isn't in check. Stalemate is a draw. This is a good design because of how it affects middlegame strategy.
It's true that it affects beginner's games negatively. One tip to avoid stalemate is don't capture all of your opponent's pieces before going for checkmate. Let them keep a single pawn for example. That way they'll (probably) have a legal move.
Good point about letting them keep one extra piece, thanks
Is it me or is this getting worse? Every few games I'm half way through the time and about to win and get a draw through "stale checkmate" thing because the opponent I'm playing with doesn't have enough class to resign. Sick of it