When you put the opponent in checkmate, you win the game. When the opponent puts you in checkmate, you lose the game. The game ends with checkmate.
There is another way for you to win the game, though, and that is when the opponent gives up or resigns. It may not be checkmate yet, but the opponent may think he has no chance to win the game, or even to get a draw. He wants to quit right away, before the checkmate comes.