Resignation is a common way for chess games to end, especially at higher levels of play. When a player recognizes that the position is objectively lost and there are no realistic chances of a swindle or opponent's error, continuing to play is generally considered disrespectful of the opponent's time and skill.
The conventional way to resign is to tip over one's king, extend a hand, or verbally announce the resignation. In online chess, a resign button serves the same purpose. Strong players often resign well before checkmate, sometimes as early as the opening if they fall into a known theoretical trap that leads to a losing position.
Beginners are often advised not to resign too early, as opponents at lower levels may miss winning continuations. However, as players improve, they develop a better sense of when a position truly is beyond saving and learn to resign with grace.