When discussing something like the technology behind slot machines, it is vitally important to divide the slot machines themselves up into two categories. These categories, as you might already be able to guess, are the categories of online slot machines and offline slot machines. The reason this is necessary is because they work in completely different ways.
Offline slot machines have a lot more hardware involved in their performance and for this reason need to be maintained quite a bit more. The actual operation of most offline slot machines nowadays is completely electronic and for that reason the mechanisms themselves are tied to when you press the spin button or pull the actual arm of the slot machine. Once you have done that, the mechanisms will spin the reels and will randomize the stopping so that particular symbols end up coming up on the reels. Those symbols are tied to patterns that can be recognized by the slot machine and for this reason the machine knows exactly when you have a winning combination. Most slot machines will give you credits rather than coins for each win and then at the end of your session you can cash out and the machine will release the appropriate number of coins to you.
This massive hardware setup that offline slot machines have is quite different from the online slot machines which are pretty much completely software in nature. While hardware is required in the form of servers to run the slot machines, the actual machines themselves run through the use of programming code, most of which is written in order to simulate what the offline slot machines do hardware wise. Rather than actual randomness which is easy to accomplish with hardware, slot machines are mostly pseudo-random, with their random number generators evaluated and certified by third party agencies. Free slots work in the same manner, which is why you can play free slots in order to evaluate the paid ones.