To the player, a slot game looks like spinning reels slowing down to a stop. In reality, the result is determined the exact millisecond you press the spin button. The animation you see is simply a visual presentation of a result that already exists in the game's memory.
This is made possible by a system called the Random Number Generator (RNG). The RNG is a complex algorithm that generates a continuous stream of numbers, even when no one is playing. When you click "Spin," the game picks the very next number in that sequence and maps it to a specific combination of symbols on the reels.
The most critical thing to understand is that every spin is an independent event. The RNG does not remember that you just had five losing spins, nor does it care that you just hit a big win. The odds of the next spin are exactly the same as the first spin of the day, regardless of what happened moments before.