Chess can end in a draw, also known as a stalemate, a few different ways.
The first, and most commonly discussed, is when there is no legal move available, but there is also no checkmate.
A stalemate can also occur if neither player has sufficient material to execute a checkmate. This often happens when both players have eliminated nearly all of each other’s pieces, leaving just the Kings left.
Perhaps the most convoluted way a stalemate can occur is if each player executes the same moves too many times.
The specific amount of repetition required for a stalemate in chess is threefold repetition. This means that if the board state of the game repeats itself three times, the game is a stalemate. For that to happen, each player would have to move a piece back and forth two times to create the triple occurrence of all pieces’ positionings.
The repetition of boardstate doesn’t need to happen in succession either. If players move pieces around, a game can end in a stalemate due to repetition after many more than the minimum of just four total moves by each player.
The ideology behind the rule is that if the exact board state is accomplished three times in a match there isn’t sufficient enough progress being made in the match for it to continue, making it a draw.