It may not be widely known, but mathematics and magic make a natural pairing. Self-working tricks, in particular, rely on the "mathematical guarantees" that ensure a trick will succeed, allowing the magician to concentrate on presentation, drama, trappings and interaction with the audience (see the feature "Mathematics of Performance" in Tangente 152, 2013). Arithmetic is ideal for ensuring that a numerical property or invariant survives to the end of a trick (see The Magic of Mathematical Invariants, Bibliothèque Tangente 47, 2013). Congruences play a starring role here; the three examples below should convince you.
With a stacked deck ----------------
"The Thirty-Two-Card Stack," a trick devised by the author, uses a standard thirty-two-card deck. The four suits are denoted T (clubs), P (spades), C (hearts) and K (diamonds). The magician can identify a card from its position (from 1 at the top to 32 at the bottom), or give the position of a particular card chosen by a spectator.
The deck is arranged face down, from top to bottom, as follows: King T, 10C, Jack P, 7K, Ace T, Jack C, Queen P, 8K, 7T, Queen C, King P, 9K... The suits T, C, P and K repeat in that order. For the ranks, the magician chooses the first four (King, 10, Jack and 7); every four cards, each rank then advances by one step through the cycle 7–8–9–10–J–Q–K–Ace–7–8–... (the King becomes an Ace, the 10 becomes a Jack, the Jack becomes a Queen, the 7 becomes an 8...).
Given this arrangement, how can the magician determine the suit from the position? A little arithmetic modulo 4 (and some practice!) provides the answer. All calculations are performed modulo 4.