When you press the spin button, the most important part of the process happens in a fraction of a second. The outcome of your spin is decided the exact moment you click, long before the reels actually stop moving. This is made possible by the Random Number Generator (RNG), a sophisticated mathematical algorithm that produces a continuous stream of random numbers.
The spinning reels, the flashing lights, and the sound effects are simply an animated presentation of a result that already exists in the game's data. Because the RNG works instantly, every single spin is an independent event. This means the game does not remember if you won or lost on the previous spin; the odds remain exactly the same every time you start a new round, regardless of your history in that session.