Integrating $\int_0^\pi \frac{x\cos x}{1+\sin^2 x}dx$ I am working on $\displaystyle\int_0^\pi \frac{x\cos x}{1+\sin^2 x}\,dx$
First: I use integrating by part then get 
$$ x\arctan(\sin x)\Big|_0^\pi-\int_0^\pi \arctan(\sin x)\,dx $$
then I have $\displaystyle -\int_0^\pi \arctan(\sin x)\,dx$ because $x\arctan(\sin x)\Big|_0^\pi$ is equal to $0$
However, I don't know how to integrate $\displaystyle -\int_0^\pi \arctan(\sin x)\,dx$
Can someone give me a hint?
Thanks

Split the integral at $\dfrac{\pi}{2}$, we get 
$\displaystyle \begin{align} \int_0^\pi \frac{x\cos x}{1+\sin^2 x}\,dx &= \int_0^{\pi/2} \frac{x\cos x}{1+\sin^2 x}\,dx + \int_{\pi/2}^{\pi} \frac{x\cos x}{1+\sin^2 x}\,dx \\ & = \int_0^{\pi/2} \frac{x\cos x}{1+\sin^2 x}\,dx - \int_0^{\pi/2} \frac{(x+\pi/2)\sin x}{1+\cos^2 x}\,dx \\ &= 2\int_0^{\pi/2} \frac{x\cos x}{1+\sin^2 x}\,dx - \pi\int_0^{\pi/2} \frac{\cos x}{1+\sin^2 x}\,dx  \\ &= 2\int_0^{\pi/2} \frac{x\cos x}{1+\sin^2 x}\,dx - \frac{\pi^2}{4}\end{align}$
At this point we can write the above integral:
$\displaystyle \int_0^{\pi/2} \frac{x\cos x}{1+\sin^2 x}\,dx = \frac{\pi^2}{8} - \int_0^{\pi/2} \tan^{-1} \sin x \,dx$
The later can be evaluated in many ways. See for example Here.
See integral representations of Legendre $\chi$-function.
Also sos440 blog entry has a very nice solution to the problem.
