Here is an (admittedly somewhat horrible) solution using both the Riemann-Lebesgue lemma and the residue theorem. Let $ f(x) = \frac{x^2}{\sin x} \quad \text{ and } \quad g(x) = \frac{\pi^2}{2} \frac{1-\cos x}{\sin x} $ on $(-\pi,\pi)$. Then $ h(x) = f(x)-g(x) = \frac{x^2 - \frac{\pi^2}2(1-\cos x)}{\sin x}$ is actually continuous on the closed interval $[-\pi,\pi]$, since both the numerator and denominator have simple zeros at $\pm \pi$ and at $0$, so that the quotient has removable singularities there. Then the Riemann-Lebesgue lemma implies that $ \lim_{n\to\infty} \int_{-\pi}^\pi h(x) \sin (2nx) \, dx = 0, $ so that $ \lim_{n\to\infty} \int_{-\pi}^\pi f(x) \sin (2nx) \, dx = \lim_{n\to\infty} \int_{-\pi}^\pi g(x) \sin (2nx) \, dx $ if either of those limits exists. The integral on the right-hand side for fixed $n$ can now be evaluated by standard residue theorem techniques, using the substitutions $z=e^{ix}$, $\cos x = \frac12(z+z^{-1})$, $dx = \frac{dz}{iz}$, $\sin x = \frac{1}{2i}(z-z^{-1})$, $\sin (2nx) = \frac{1}{2i} (z^{2n}-z^{-2n})$, which yields $ \begin{align*} \frac{\pi^2}{2} \int_{|z|=1|} & \frac{1-\frac12 (z+z^{-1})}{\frac1{2i}(z-z^{-1})}\frac{z^{2n}-z^{-2n}}{2i} \frac{dz}{iz} = \frac{\pi^2}{4i} \int_{|z|=1} \frac{2-z-z^{-1}}{z^{2n}} \frac{z^{4n}-1}{z^2-1}\, dz \\ &=\frac{\pi^2}{4i} \int_{|z|=1} \frac{2-z-z^{-1}}{z^{2n}} (1+z^2+z^4\ldots + z^{4n-2}) \, dz \\ &=\frac{\pi^2}{4i} \int_{|z|=1} (2-z-z^{-1}) (z^{-2n}+z^{-2n+2}+z^{-2n+4}\ldots + z^{2n-2}) \, dz \\ &= \frac{\pi^2}{4i} 2\pi i a_{-1} = \frac{\pi^3}{2} a_{-1} = \frac{\pi^3}{2}(-2) = -\pi^3 \end{align*} $ where $a_{-1}=-2$ is the coefficient of $z^{-1}$ in the integrand which is easily found by multiplying the terms in parentheses.