In my professor's lecture notes about black-body radiation, a black body modeled by an opaque hollow box with a small hole is considered.
After explaining why this is a sound model for a black-body, the notes go on to calculate the energy distribution of a normal mode of the radiation as follows:
The amount of energy in the normal mode $\omega$ is $E=n\hbar\omega$. Hence the probability of having $n$ photons existing in the normal mode $\omega$ is: $$P(n)=\frac{e^{-n\hbar\omega\beta}}{Z}$$ where the partition function is: $$Z=\sum_{n=0}^{\infty}e^{-n\hbar\omega\beta}$$
This seems to suggest that the entire normal mode, which I understand to mean "All photons of frequency $\omega$", can be treated as an isolated system in equilibrium with a reservoir at temperature $K_BT=\frac{1}{\beta}$.
How is this possible? If the system as a whole, that is the black-body, is at thermal equilibrium with the reservoir, why does that imply that if we only consider photons emitted by the body at a certain definite frequency then they are a at equilibrium with the reservoir by themselves, irrespective of all other radiation (and energy within the body)?
NOTE: I was uncertain whether this falls more under the "thermodynamics" or "quantum-mechanics" tag. Please feel free to correct my tagging if it is wrong.