Evaluate $\int_0^{\pi} \frac{x \sin x}{1+\cos ^2 x}dx$ Find $$\int_0^{\pi} \frac{x \sin x}{1+\cos ^2 x}dx$$ by hand. I'm aware Mathematics gives $\frac{\pi^2}{4}$, but I need to learn this without the aid of Mathematica. I tried using substitutions like $u= \tan \frac{x}{2}$ and some trig identities, but I still can't work this out.

I prove lemma that says that $$\int_0^\pi xf(\sin x)dx=\frac{\pi}2\int_0^\pi f(\sin x)dx$$
let $t=\pi-x$,so
\begin{align*}
\int_0^\pi xf(\sin x)dx&=\int_\pi^0(\pi-t)f(\sin(\pi-t))(-dt)=\int_0^\pi(\pi-t)f(\sin t)dt\\
&=\pi\int_0^\pi f(\sin t)dt-\int_0^\pi tf(\sin t)dt
\end{align*}
so
$$\int_0^\pi xf(\sin x)dx=\dfrac{\pi}{2}\int_0^\pi f(\sin x)dx$$
Finally
\begin{align*}
 \int_0^{\pi} \frac{x \sin x}{1+\cos ^2 x}dx&=\dfrac{\pi}{2}\int_0^\pi\frac{ \sin x}{1+\cos ^2 x}dx=-\dfrac{\pi}{2}\int_0^{\pi}\frac{1}{1+\cos ^2 x}d\cos x\\
&=-\dfrac{\pi}{2}\arctan\cos x\Bigg|_0^\pi=\dfrac{\pi^2}{4}
\end{align*}
