God does not play dice. ~ Albert Einstein
Albert Einstein got off to one of the greatest starts in scientific history. His papers on the photon, special relativity, and general relativity established him as one of the greatest minds of all time. His researches led others off into researches that might have been considered utterly fantastic at one time. With Einstein providing their basis, though, the new theories flew.
Einstein, himself, became an icon. He was eminently quotable and was willing to offer a quip at any time. The press and the public loved him. Some of his fellow physicists, however, would soon take a tack that Einstein could not follow.
If you go back to Newtonian physics, you see that the laws of motion essentially lay down hard laws about how everything gets from here to there or how it stays put. It was the root of determinism, the philosophy that everything is predetermined based on some initial conditions of the universe. In theory, if you could measure the position and motion of every particle in the universe, you could predict everything that would happen from then on. When Einstein developed his theories of relativity, he extended determinism to the far reaches of the universe, explaining what happened at great distances and at high speeds.
This is no small idea. If everything is essentially predictable, then we are simply going through the motions. It doesn't matter what you think you might do; all your actions are predestined. Free will is a myth.
You might think that this is merely a philosophical exercise. After all, no one can, in practice, find the positions and motions of all particles in the universe, so no one can really predict anything. But, it doesn't matter that you don't have the means to find out where it all is. What matters is that everything is following set laws and is locatable. That means you're just a large particle getting bounced around by other large particles.
This has been a fundamental bone of contention to philosophers for generations. If you're a believe in determinism, then you can argue that no one is actually accountable for their actions because they had no choice in the matter. In the opposing camp were the believers in free will, who felt that we are masters of our fate; our actions can be altered and can alter events. Most importantly, we are responsible for what we do and can choose whether we will do good or ill. Einstein seemed to have sealed the deal in favor of determinism.
Then along came Werner Heisenberg.
Heisenberg was one of a group of physicists who had used some of Einstein's own theories to develop quantum mechanics. If relativity is the theory of the very large, quantum mechanics is the theory of the very, very, very small. Heisenberg and the rest of the so-called Copenhagen Group, led by Neils Bohr, were the champions of quantum mechanics. And quantum mechanics said that atomic particles were ruled by probability.
Heisenberg went further. He said that the very act of measurement changed the state of a particle. If you measured the position of, say, an electron, you could not say anything about it's velocity or momentum. If you measured it's velocity, you altered its position. In other words, you could not know all the attributes of a particle. This was the Heisenberg Uncertainty principle.
Einstein hated quantum mechanics. His line about God and dice came about because he refused to accept that quantum mechanics spoke only in probabilities. He was also quick to realize that elements of quantum mechanics implied some pretty strange things, such as “spooky action at a distance.” If you have an electron pair, one is spinning one way while the other is spinning the other way (actually, "spin" is a more complex proerty than that, but we'll pretend it's just rotation). Quantum mechanics says that, until you measure one, they both have all the possible spin properties. The measurement of one collapses the probability function and determines the spin of the other. If you separate them prior to measurement, it is theoretically possible, then, to measure one, say on Earth. If the other has been transported to Mars, and its spin is then checked, it will be found to be spinning differently from the other.
And this will be the case even if they are measured simultaneously. The information from one will instantaneously set the other, which is a violation of special relativity which says that this information cannot travel faster than the speed of light. Experiments have been conducted that show that this effect actually occurs.
(I apologize for the lame explanation. Check out John Gribbin's In Search of Schroedinger's Cat, among others, for a more lucid description of the quantum effects.)
But, in Einstein's day, the technology to conduct such experiments didn't yet exist, so he could engage in debates with Neils Bohr over the validity of quantum mechanics. Einstein would concoct a thought experiment and challenge Bohr to show where it was wrong. And, after some thought, Bohr would do so. Ultimately, in frustration, Einstein uttered his famous line. Bohr replied to the effect that Einstein shouldn't be telling God how He should do things.
Ultimately, it has turned out that quantum mechanics works. The implication is that the universe is variable, shaped by the actions of the particles, large and small, that inhabit it. There are laws and theories that allow us to make predictions and manage events to some extent, but there is also uncertainty. And that uncertainty is the realm of free will. Some people are very uncomfortable with that; they would rather believe that higher powers call the shots while we merely shuffle along. I don't think Einstein thought in those terms. He wanted to understand the universe down to the smallest atom. The fact that he couldn't pin down these illusive little critters bothered him to the end of his days. He became isolated from the society of physicists who moved on to new discoveries and theories.
But, then, he did it of his own free will.