Slot machines contain random number generators that can generate thousands of numbers per second, each of which is associated with a different combination of symbols. Whether you win or lose is determined by the random number generated in the exact instant you activate each play - if it matches a payline, you win.