We can approximate a diatomic molecule as a rigid bodies, ignoring their vibrational motion for now.
Conditions:
The two masses $m_1$ and $m_2$ separated by a distance $r_0$
they are free to rotate around their common CoM
Its moment of inertia is given by
$$ \begin{aligned} I &= m_1\left(\frac{m_2}{m_1+m_2}\,r_0\right)^2+m_2\left(\frac{m_1}{m_1+m_2}\,r_0\right)^2 \\ &= \frac{m_1\,m_2}{m_1+m_2}\,r_0^2 \equiv \mu\,r_0^2
\end{aligned} $$
where $\mu$ is the reduced mass
Classically the kinetic energy and angular momentum are given by
$$ \begin{aligned} E&={\textstyle{\frac12}}I\,\omega^2\\ L&=I\,\omega
\end{aligned} $$
Since $L$ is conserved we can write kinetic energy as
$$ E = \frac{L^2}{2I} $$
The potential energy function is zero therefore we expect in quantum mechanics
$$ \widehat{H}=\frac1{2I}\,\widehat{L}^2 $$
We know the eigenvalues and eigenfunctions of $\widehat{L}^2$ we can immediately write down the rotational energy levels of a diatomic molecule
$$ E_\ell = \frac{\hbar^2}{2I}\,\ell(\ell+1) $$
💃 Example: for an $H_2$ molecule $\mu=m/2=0.84 \times 10^{-27}$ , $r_0=0.74 \r{ \text A}$
$$ \Rightarrow\frac{\hbar^2}{2I}=7.5\times10^{-3}\,\mathrm{eV} $$
🗒️ Notes:
Experimenters in microwave spectroscopy typically quote their results in wave number, measured in $\text{cm}^{-1},\widetilde{\nu}$
$$ \widetilde{\nu}=\frac1\lambda=\frac{f}{c}=\frac{E}{hc}=\frac{h}{8\pi^2cI}\ell(\ell+1)\equiv B\ell(\ell+1) $$
🗒️ Note: to give $B$ in $\mathrm{cm}^{-1}$, $c$ should be used in $\mathrm{cm\,s}^{-1}$)
The energy diagram is:
Only transitions $\Delta l=\pm 1$ are allowed by emission/absorption of one photon
Therefore we get absorption lines at $\widetilde{v}=2B,4B,6B,8B,\ldots$
$B$ can be measured from the microwave absorption spectrum and hence $I$ and $r_0$
In practice diatomic molecules vibrate and rotate simultaneously. The vibration spectrum we calculated previously are a more complicated because the vibrational transition can only occur by a single photon if it is accompanies by a rotational transition with $\Delta l=\pm 1$.
Thus each vibrational infrared absorption line is actually a series of very close but equally spaces lines with the centre one missing.