There are hundreds of different types of slot machines, including single-line slots, multi-line slots, progressive slots, video slots, and online slots. They all work on the same principle, and are governed by a 'random number generator' that determines the combination of symbols that you see when you spin.
The random number generator (or RNG) continually picks number series that correspond to the various symbols on the reels or to blank spaces. The RNG is continuously cycling through numbers even when the machine is not being played. When a player puts in their coins and then pulls the handle, the computer spins the reels to tell the player the number series that was chosen when that coin went in.