What counts as the same position
The same pieces must stand on the same squares, the same player must be to move, and the castling and en passant possibilities must be identical. The repetitions do not need to be consecutive, and the moves in between do not matter.
Over the board you claim the draw by writing your intended move on the scoresheet without playing it, then stopping the clock and calling the arbiter. If the claim is wrong, the opponent usually gets extra time and you must play the move you wrote.
Under FIDE Article 9.6 the game is drawn automatically if the same position appears five times. Online platforms usually apply the threefold rule automatically.
Perpetual check
The most common route to repetition is perpetual check: the losing side checks the enemy king endlessly because the king cannot escape. Perpetual check is not a separate rule; it ends through threefold repetition or by agreement.