Ok, I see you're going far afield. Temperature can impact spectral lines through Doppler broadening, but the answer is much simpler, so let me help you out a bit more.
Let's suppose you have a closed vessel with your gas of interest with rotational constant B. If there is heat available (i.e., nonzero temperature), the molecules will be rotating (and moving and vibrating, but forget that for a moment: rotation only right now). The frequencies at which they rotate are quantized - only specific frequencies are allowed, which are specified by the quantum number J and the rotation constant B, which is related to the inertial mass and bond length. J can be anywhere from 0, 1, 2, 3, ...∞. There are an infinite number of rotational states, and the higher J is, the more energy the molecule has (faster rotation).
Now, suppose you were able to zoom in with a special magnifiying glass and look at all the individual molecules in the vessel, and I asked you to make a table where you counted how many molecules in the sample were rotating with each J value, what would you expect to find?
Well, it should be obvious what you would NOT expect to find. You would expect to find that every molecule wouldn't be rotating with the same speed: there would be a distribution of values. Some would be faster, some would be slower. And there would be a mean value.
Ok, let's do a little experiment. Let's cool your vessel of gas down to absolute zero Kelvin and then use your magic magnifying glass again. What do you find? With no energy in the environment, you'd find that the molecules were no longer rotating. NONE OF THEM. Because there's no energy to be fed into rotational states. Every molecule will have J = 0.
Now, let's add a little heat into the system. Just a little. The temperature is no long zero Kelvin it's 0.00000001 Kelvin. Use your magnifying glass again. What do you see? Now there is just a tiny bit of heat, enough so that a handful of molecules start to rotate. Most of them are still at J = 0, but now you see a few in J = 1 state, maybe even one or two at J = 2.
Now add a bit more, and a bit more, and a bit more heat. Each time the temperature goes up a little bit, the average rotational energy of the molecules will increase, which means the average J value increases. There will always be a distribution of energies (except in the one case of T = 0 K, where all the molecules are at J = 0), but I think you can see now that there will be some kind of correlation between the mean J value in the sample and the temperature.
Onward, to Boltzmann! The Boltzmann constant is essentially a way to relate the distribution of molecular energies (levels populated) with the temperature. You should know by now that at a given temperature, there will be a distribution of kinetic energies: not all molecules move at the same speed because there are all kinds of collisions going on. This will slow some down and speed some up. This translates into the natural distribution of molecular states observed at any one time - and it works for all kinds of states: vibrational, rotational, whatever. The Boltzmann constant is a statistical constant that allows you - through equations like you posted above and the partition coefficient - to say, 'If the temperature is T, what proportion of the molecules will be in state S with respect to all the possible states there can be?' That probability will be a function of the temperature and the energy of the state. The higher the temperature, the more energy is, the more higher level energies are likely to be populated at any time. The Boltzmann constant allows you to quantitatively determine these probabilities.
So, with all that in mind, what can we say of spectroscopy? I will say one more thing here and then let you come up with the rest. The lines in a rotational spectrum originate from transitions between J and J + 1. The difference between any J and J + 1 level is given by the energy formula for a rigid rotor (under that approximation), and the difference between any two lines should be about 2B. If EVERY rotational level were equally populated when an experiment was performed, the rotational spectrum would be an infinite number of lines, each separated by 2B and starting at the energy difference between J = 0 and J = 1 (also 2B, so the spectrum would be an infinite number of lines: 2B, 4B, 6B, 8B, . ∞). For example, if B is 100 whateverunits, then the spectrum would have a line at 200, 400, 600, 800, ... ∞. The relative intensity of any line is (in principle) proportional to the number of molecules in the rotational state associated with the line at the time of the experiment. So if two times the number of molecules are at J = 2 than are at J = 3, then the J = 2 to J = 3 line will be double the intensity of the J = 3 to J = 4 line. (In practice line intensities are affected by other things as well, but let's keep it simple.)
At absolute zero, only the lowest rotationl level can be populated, so the spectrum at 0 K would have exactly one line: at 2B. No other lines could be observed at this temperature because no other states can be populated - you won't see the characteristic line for the J = 3 to J = 4 transition because there are no molecules that start at J = 3 when the temperature is zero Kelvin. You have to have molecules at a given rotational level to see the spectral line that originates from this rotational levels.
Alright. We've already looked through your magnifying glass at what happens to molecules when you increase the temperature a little bit above absolute zero. Of course, we don't have magic magnifying glasses. We have spectrometers! So, what does your spectrometer see when you start at absolute zero and increase the temperature just a little bit? You will no longer have a single line at 2B originating from J = 0 to J = 1. So what do you have? And how can you generalize this to what you might observe at any temperature?
The best answer will invoke the kind of equation you posted in your opening post, but let's still forget equations. Just think about how the spectrum will change as temperature increases. Then we can discuss how to use the equation in more detail if you wish to calculate temperature from spectral data - but you sould get yourself to the point how you understand HOW it could work before you start to even think about equations.