Compute the trigonometric integrals
Solution 1:
Here's a way to find $I_n$ with the residue theorem: first, by symmetry, $I_n = \frac{1}{2} \int_0^{2\pi} \frac{1 - \cos(nx)}{1- \cos(x)}dx$. Consider $z = e^{ix}$ such that the integral with now be on the edge of the unit circle $C$, and use the fact that $$\cos(nx) = \frac{e^{inx} + e^{-inx}}{2}.$$ as well as $\frac{dz}{dx} = i e^{ix}$. So $dx = \frac{1}{iz} dz$ and
$$\int_0^{2\pi} \frac{1 - \cos(nx)}{1 - \cos(x)} dx = \int_C \frac{1}{iz} \frac{1 - \frac{1}{2}(z^{n} + z^{-n})}{1 - \frac{1}{2}(z + z^{-1})}dz$$ $$= \frac{1}{i}\int_C \frac{1}{z^{n}} \left(\frac{z^n - 1}{z - 1}\right)^2 dz$$ $$= \frac{2\pi i}{i} \mathrm{Res}_{z = 0} \frac{1}{z^{n}} (1 + ... + z^{n-1})^2 = 2\pi n$$
and so $I_n = \pi n$.
Solution 2:
As for the first integral $$ I_n=\int\limits_{0}^\pi\frac{1-\cos nx}{1-\cos x}dx= \int\limits_{0}^\pi\frac{\sin^2 (nx/2)}{\sin^2(x/2)}dx= 2\int\limits_{0}^{\pi/2}\frac{\sin^2 (nx)}{\sin^2(x)}dx= 2\int\limits_{0}^{\pi/2}\left(\frac{\sin (nx)}{\sin(x)}\right)^2dx= $$ $$ 2\int\limits_{0}^{\pi/2}\left(\frac{e^{inx}-e^{-inx}}{e^{ix}-e^{-ix}}\right)^2dx= 2\int\limits_{0}^{\pi/2}\left(\sum\limits_{k=0}^{n-1}(e^{ix})^k (e^{-ix})^{n-k-1}\right)^2dx= $$ $$ 2\int\limits_{0}^{\pi/2}\left(\sum\limits_{k=0}^{n-1}(e^{ix})^{2k+1-n} \right)^2dx= 2\int\limits_{0}^{\pi/2}\left(\sum\limits_{k=0}^{n-1}(e^{ix})^{2k+1-n} \right)\left(\sum\limits_{l=0}^{n-1}(e^{ix})^{2l+1-n} \right)dx= $$ $$ 2\int\limits_{0}^{\pi/2}\sum\limits_{k=0}^{n-1}\sum\limits_{l=0}^{n-1}(e^{ix})^{2k+1-n+2l+1-n}dx= 2\sum\limits_{k=0}^{n-1}\sum\limits_{l=0}^{n-1}\int\limits_{0}^{\pi/2}(e^{ix})^{2k+2l+2-2n}dx= $$ $$ 2\sum\limits_{k=0}^{n-1}\sum\limits_{l=0}^{n-1}\frac{\pi}{2}\delta_{2k+2l+2-2n}= \pi\sum\limits_{k=0}^{n-1}\sum\limits_{l=0}^{n-1}\delta_{2k+2l+2-2n}=\pi n $$ As for the second... I'll think about it.
Solution 3:
The exponential generating function of $J_{m,n}$ for fixed $n$ is $$G_n(t) = \sum_{m=0}^\infty J_{m,n} t^m/m! = \int_0^\pi e^{tx} \dfrac{\sin(nx)^2}{\sin(x)^2}\ dx$$ We then have $(\sin(nx)/\sin(x))^2 = n + 2 \sum_{j=1}^{n-1} (n-j) \cos(2 j x)$ and $$G_n(t) = (e^{\pi t} - 1) \left(\frac{n}{t} + 2 \sum_{j=1}^{n-1} (n-j) \dfrac{t}{t^2 + 4 j^2}\right)$$
EDIT: For example, $G_3(t) = (e^{\pi t} - 1) \left(\dfrac{3}{t} + \dfrac{4t}{t^2+4} + \dfrac{2t}{t^2+16}\right)$. Now $$e^{\pi t} - 1 = \sum_{j=1}^\infty \pi^j \dfrac{t^j}{j!} = \pi t + \dfrac{\pi^2 t^2}{2} + \dfrac{\pi^3 t^3}{6} + \ldots$$ $$\dfrac{3}{t} + \dfrac{4t}{t^2+4} + \dfrac{2t}{t^2+16} = \dfrac{3}{t} + \sum_{j=0}^\infty (-1)^j(4^{-j}+ 16^{-j}/8) t^{2j+1} = \dfrac{3}{t} + \left(1+\dfrac{1}{8}\right) t - \left(\dfrac{1}{4} + \dfrac{1}{16 \times 8}\right) t^3 + \ldots$$ and so $J_{m,3}$ is $m!$ times the coefficient of $t^m$ in the product of these.
Solution 4:
Another generating function approach is to set $z=e^{ix}$ in $$ \begin{align} &\sum_{k=0}^\infty\frac{(it)^m}{m!}\int_0^{\pi}x^m\frac{1-\cos(nx)}{1-\cos(x)}\,\mathrm{d}x\\ &=\int_0^{\pi}z^t\left(\frac{z^n-1}{z-1}\right)^2\frac{\mathrm{d}z}{iz^n}\\ &=\frac1i\int_0^{\pi}\left(\sum_{k=1-n}^{n-1}(n-|k|)z^{k+t-1}\right)\mathrm{d}z\\ &=\frac1i\sum_{k=1-n}^{n-1}(n-|k|)\frac{(-1)^ke^{\pi it}-1}{k+t}\\ &=in\frac{1-e^{\pi it}}{t}-2it\sum_{k=1}^{n-1}\frac{n-k}{k^2-t^2}\left(1-(-1)^ke^{\pi it}\right)\tag{1} \end{align} $$ As $t\to0$, it is easy to see that we get $\pi n$.