The slot machine is certainly one of the more successful ingenious devices that Sir William Blackstone was referring to in his Commentaries on the Laws of England. Created 107- 115 years after his death (depending on the invention date you accept), the slot machine is the mainstay of the casino business.
Charles Fey is generally accepted as the inventor of the mechanical slot machine, with spinning reels and the ability to dispense coins to the winners. Some reports indicate that he had a working model as early as 1887, but the date of 1895 is more popularly reported as the invention date.
Bengamin "Bugsy" Siegel is credited with bringing them to Las Vegas to fill space in the casino at the Flamingo hotel in the 1940's. Initially intended to entertain the girlfriends and wives of his rich players while the men did the real gambling, they soon took over the casinos.
These 100% mechanical devices were powered by pulling the lever to power the machine and start the wheels spinning until they came to a random stop determining the outcome of the bet. The odds of winning were determined by the number of times a particular image appeared on a real.
These mechanical slots and their improved models were the norm until 1964 when Bally introduced the first electromechanical slot machine. These new Bally machines were more difficult to cheat and provided the ability for larger payouts without the need for attendant assistance. These quickly became the norm.
Development continued through the 70's and by about 1984 the all computerized machines using a microprocessor with a random number generator (RNG) were introduced. These machines are all computer driven and the wheels spin merely for the amusement of the player. They utilize incredibly refined technology, explicitly designed to deliver maximum entertainment to the user and maximum profit to the casino.
These RNG machines use a microprocessor similar to the one in your home computer, but it only runs one set of software to generate the random numbers. Those numbers determine the outcome. The machine is computing a string of random numbers anytime the power is supplied. The number in memory at the time the lever is pulled or the button is pressed determines the outcome of the bet. One second sooner or later and the number would be completely different.
The above is an extremely simplified explanation. If you want a lot more details there are two excellent articles I discovered in researching this article.
Understanding the Random Number Generator (RNG)