You win by checkmating your opponent and lose by being checkmated. A player may concede victory to the opponent at any time by laying their king on its side. In matches that end in a draw, neither player wins and neither loses. There are several ways a match might end in a draw.
Draw by Agreement
Both players may agree to declare a draw. Mutual consent is all that is required.
Draw by Stalemate
When a player cannot make a legal move, yet is not in check, the match has ended in a draw by stalemate.
Draw by Insufficient Material
When neither player has sufficient pieces to force a checkmate, a draw may be declared.
Draw by Repetition
If a player is about to repeat a position for a third time, that player may declare a draw by repetition. (The term "position" here means the precise arrangement of all the pieces on the board at a given time.) If the player who completes the third repetition does not declare a draw, the opponent may then declare it. This type of draw cannot be declared without an undisputed record of the match.
If during the previous fifty moves no pawn has been moved and no capture has been made, either player can claim a draw. (For this purpose a "move" consists of a player completing their turn followed by the opponent completing their turn).