Example 10 Calculate
$$
I_{m}=\cot ^{2} \frac{\pi}{2 m+1}+\cdots+\cot ^{2} \frac{m \pi}{2 m+1}
$$

the value.
$$
\begin{array}{l} 
\sin (2 m+1) \\
= \operatorname{Im}(\cos \theta+\mathrm{i} \sin \theta)^{2 m+1} \\
= \mathrm{C}_{2 m+1}^{1} \sin \theta \cdot \cos ^{2 m} \theta-\mathrm{C}_{2 m+1}^{3} \sin ^{3} \theta \cdot \cos ^{2 m-2} \theta+ \\
\cdots+(-1)^{m} \mathrm{C}_{2 m+1}^{2 m+1} \sin ^{2 m+1} \theta \\
=\left(\sin ^{2 m+1} \theta\right) P_{m}\left(\cot ^{2} \theta\right),
\end{array}
$$

where, $P_{m}(x)=\mathrm{C}_{2 m+1}^{1} x^{m}-\mathrm{C}_{2 m+1}^{3} x^{m-1}+\cdots+(-1)^{m}$.
When $\theta_{k}=\frac{k \pi}{2 m+1}(k=1,2, \cdots, m)$,
$$
\begin{array}{l}
\sin \theta_{k} \neq 0, \sin (2 m+1) \theta_{k}=0, \\
P_{m}\left(\cot ^{2} \theta_{k}\right)=0,
\end{array}
$$

and $\cot ^{2} \theta_{k}(k=1,2, \cdots, m)$ are distinct, thus, they are the $m$ real roots of the equation $P_{m}(x)=0$.
By Vieta's formulas, we have
$$
I_{m}=\sum_{k=1}^{m} \cot ^{2} \frac{k \pi}{2 m+1}=\frac{\mathrm{C}_{2 m+1}^{3}}{\mathrm{C}_{2 m+1}^{1}}=\frac{m(2 m-1)}{3} .
$$