1On your turn, take one or more tokens from a single row.
2Take as many as you like, but only from one row.
3Whoever takes the last token loses.
4Plan ahead: each move should leave your opponent a losing position.
Questions
Take the last object(s) to win (normal play), or avoid taking the last object (misere variant). Win by taking the last object (normal) or forcing your opponent to take it (misere). The winning strategy involves binary XOR calculations of pile sizes.
Objects (traditionally matchsticks or stones) are arranged in several piles. Classic setup: rows of 1, 3, 5, and 7 objects (16 total). Many variations exist with different starting configurations.
Learn the Nim-sum: XOR all pile sizes in binary. If Nim-sum is 0 before your move, you're in a losing position (with perfect opponent play). Always aim to leave a Nim-sum of 0 after your move. With two equal piles, mirror your opponent's moves in the other pile.
Nim was comprehensively analyzed by Charles Bouton in 1901, who proved the winning strategy. The name may come from German 'nimm' (take) or archaic English 'nim' (steal).