The history of Planck's radiation law is very interesting. The key advantage for Planck was that at this time in Berlin at the Physikalisch-technische Reichsanstalt (at this time the equivalent of today's NIST in the US) they wanted to create an objective reproducible standard for the brightness of light sources (perhaps because electric light bulbs started to substitute for the gas lights around this time). It was of course well known that thermal radiation is a natural standard, i.e., it's independent of the material of the emitter. So they started to measure the thermal spectrum of electromagnetic waves using a Platin cavity brought accurately to a stable temperature to have a (nearly) exact black-body emitter at a well-defined temperature and then measured the spectrum over a very large range of frequencies (from the IR to the far UV, if I remember right).
From the very accurate results Planck in 1899 first guessed the right law by interpolating between then known low- and high-frequency limits. Then he thought about, how to derive the law, using Maxwell electromagnetics and (phenomenological!) thermodynamics, which failed. Then, very reluctantly, he started to use Boltzmann's methods of Statistical Mechanics. Planck was not in favor of Statistical Mechanics before, but then he used Boltzmann's methods after his trials before failed. Indeed, he used Boltzmann's method to count the number of microstates of a given macrostate to get the entropy (writhing down ##S=-k_{\text{B}} \ln \Omega## for the first time!) and from that the black-body spectrum. The remarkable thing was, how he counted wave modes with discretized energies, i.e., the idea that the energy exchange between the em. field of frequency ##f## (##\omega##) and the material (theorized as harmonic oscillators, which is the most simple model, but it doesn't matter anyway for the universal black-body radiation how you model the cavity walls) is in discrete quanta of the size ##E=h \nu=\hbar \omega##. The first motivation was to make ##h \rightarrow 0## at the end of the calculation, but Planck realized that this is precisely what he shouldn't do, because with the discretized energy quanta he got precisely the spectrum he had guessed and which he knew to describe the measured spectrum very accurately. Then for the rest of his life he tried to get rid of this conclusion again and to find an argument, how to derive the black-body spectrum from classical physics, but of course in vain.
What's very interesting about Planck's derivation of the black-body spectrum is the combinatorics he used. From our modern understanding it's easy to understand, because intuitively he used the correct counting for bosons, but at his time this was not so straight forward. Maybe he was inspired from Boltzmann's solution of the Gibbs paradox, where he introduced ad hoc the famous factor of ##1/N!## for a gas consisting of ##N## "indistinguishable particles", although from the point of view of classical mechanics particles are always distinguishable through their initial state in phase space, which implies the unique state in phase space at all times, i.e., one can follow the trajectory of each particle in phase space (in principle) and thus each particle is identifiable. Anyway, I could not understand his counting method without using the argument from modern quantum theory to count the microstates for bosons. Also Planck indeed had no idea to think of his energy quanta in terms of particles, and he fought always against the idea of "light particles", and as we know now, he was not completely wrong with that since indeed the modern photon, defined through relativistic QFT is far from being particle like in a classical sense of a localizable entity.