You should really read Douglas Stone's "Einstein and the Quantum: The Quest of the Valiant Swabian." It's a brilliant work insofar as Prof. Stone shows precisely how Planck went about deriving the eponymously named Planck's law and why the quantum revolution did not beging with Planck but with Einstein. In the book Prof. Stone (Head of Applied Physics at Yale), having read T.S. Kuhn's work on the Black Body Problem and Quantum Discontinuity, as well as all of Planck's original papers and correspondence on the issue, in addition to all of Einstein's original papers and correspondence between 1879 and 1929, essentially argues that Planck's law arose as a mathematical fudgefactor. On the one end you had Rayleigh's law in the lower limit, and on the other Wien's law in the higher limit; Planck, having asserted to the Prussian Academy of Science that he had derived a formula directly from the second law of thermodynamics found himself in a dire quandary. His formula did not fit Kurlbaum's data and Planck, a very capable mathematician, simply guessed at an interpolation formula that fit Kurlbaum's new data.
One Problem, however, he couldn't explain it and buried it for 5 years - in fact, no scientist in Europe brought it up again for 5 years - until Einstein launched quantum theory in earnest in 1905 and AGAIN in 1906 with one of the most underrated papers (as Walther Nernst later acknowledged) in the history of Quantum Mechanics titled "On the Specific Heat of Solids."
The irony, of course, is that Bohr, his later sparring partner in the interpretation of QM, didn't actually believe in quantum theory for years, maintaining that "the wave model of electromagnetism is tried and tested and any theory to the contrary cannot possibly fit experiment" (or something to that effect, I'l' have to dig up the quote but Bohr was definitely not an instant believer).
After completing General Relativity, in 1917 Einstein rederives Planck's Law as well as Bohr's Frequency Rule in a completely novel way (crystallized in the A & B coefficients) and in so doing conjectures inherent randomness in quantum theory, a conceptual postulate that has remained with the theory ever since.
Watch a lecture Stone gives on the topic. Quite enlightening: http://www.grassrootstv.org/view?showID=12681
One last word on the topic. Contrary to popular opinion, Einstein's foray into revolutionizing physics didn't begin in 1905 but rather between 1902 and 1903. This is where you see the genesis of his unconventional genius. He wrote a brilliant trilogy of papers in those years deriving the foundations of statistical mechanics from first principles (a work that would make J.W. Gibbs a legend - and Gibbs work, Einstein noted, was superior but also, in a way, less daring). Einstein didn't know of Gibbs work at the time as it hadn't been properly translated into German. But even so you can see the rudiments of Einstein's thinking on light quanta and how he, and not Planck, made the leap in 1905 that light, and indeed all energy and matter, is quantized. His complete mastery of statistical mechanics and thermodynamics comes to the fore again and again throughout his development on quantum theory.
It's interesting: http://faculty.poly.edu/~jbain/heat/readings/98Navarro.pdf