Black, in check from a rook on e1, plays the knight to f6 and presses the clock. It happens at every event I have ever played in, usually in the last five minutes of a round, and it does not void the game or start an argument. There is a procedure, and it takes about a minute.
8
7
2
e
g What counts, and when it counts
A move becomes an illegal move once the player has pressed the clock (Art. 7.5.1). Until then it is just a mistake in progress, and it gets corrected on the board.
Three things count as illegal moves that do not look like moves at all. Pressing the clock without moving anything is one (Art. 7.5.3). Using two hands for a single move is another, which in practice means castling with one hand on the king and one on the rook (Art. 7.5.4). And pushing a pawn to the last rank, pressing the clock and leaving the pawn sitting there is a third; the pawn is then replaced by a queen (Art. 7.5.2).
The ordinary ones I see over the board, in rough order of frequency: leaving your own king in check, castling out of check or across a square the enemy controls, moving a piece that is pinned against your king, and playing en passant one move too late. The castling conditions are behind more of these than anything else.
The penalty
Art. 7.5.5 sets it out. The arbiter puts the position back to what it was immediately before the irregularity. For the first completed illegal move by a player, two minutes are added to the opponent’s clock. For a second by the same player, the arbiter declares the game lost, with the same exception that applies to a flag fall: if the opponent could not checkmate that king by any legal series of moves, it is a draw instead.
Note which way the clock goes. Time is given to the innocent player, not taken from the other one.
Rapid and blitz have a window
The fast formats work differently in one way that matters a great deal. Once your opponent has made their own next move, the illegal move stands and the game carries on from the position in front of you, unless the two of you agree otherwise without the arbiter. There is no going back to move nineteen.
How the first illegal move is penalised in rapid and blitz depends on the regulations of the event and on how closely the games are supervised, which Appendix A of the Laws sets out. Listen to the arbiter’s briefing before round one rather than assuming your club’s habit is universal.
At the board, do this
Stop the clock. Put your hand up. Say nothing else to your opponent.
Do not reset the pieces yourself, do not explain the rule across the table, and do not accept your opponent’s offer to just take it back if you are in a rated game. The arbiter establishes the position, applies the two minutes and restarts the clocks. It is their job and they would rather do it than untangle what the two of you agreed.
Nearly all of this comes from playing the move you decided on three minutes ago in a position that has since changed. The cure is the same one that catches most blunders: before your hand moves, look at every check your opponent has, including the one they just gave you. There is a page on not noticing a check, and it is a more common problem than anyone admits.