Integrating $\int^0_\pi \frac{x \sin x}{1+\cos^2 x}$ Could someone help with the following integration:
  $$\int^0_\pi \frac{x \sin x}{1+\cos^2 x}$$
So far I have done the following, but I am stuck:
I denoted $ y=-\cos x $ then:
$$\begin{align*}&\int^{1}_{-1} \frac{\arccos(-y) \sin x}{1+y^2}\frac{\mathrm dy}{\sin x}\\&= \arccos(-1) \arctan 1+\arccos 1 \arctan(-1) - \int^1_{-1}\frac{1}{\sqrt{1-y^2}}\frac{1}{1+y^2} \mathrm dy\\&=\frac{\pi^2}{4}-\int^{1}_{-1}\frac{1}{\sqrt{1-y^2}}\frac{1}{1+y^2} \mathrm dy\end{align*}$$
Then I am really stuck. Could someone help me?
 A: Let $$I = \int_0^{\pi} \dfrac{x \sin(x)}{1+\cos^2(x)} dx = \int_{-\pi/2}^{\pi/2} \dfrac{(x+\pi/2) \sin(x+\pi/2)}{1 + \cos^2(x+\pi/2)} dx = \int_{-\pi/2}^{\pi/2} \dfrac{(x+\pi/2) \cos(x)}{1 + \sin^2(x)} dx $$
Now
$$\int_{-\pi/2}^{\pi/2} \dfrac{(x+\pi/2) \cos(x)}{1 + \sin^2(x)} dx = \int_{-\pi/2}^{\pi/2} \underbrace{\dfrac{x \cos(x)}{1 + \sin^2(x)}}_{\text{Odd function}} dx + \dfrac{\pi}2 \cdot \int_{-\pi/2}^{\pi/2} \dfrac{\cos(x)}{1 + \sin^2(x)} dx $$
Hence, we get that
$$I  = \dfrac{\pi}2 \cdot \int_{-\pi/2}^{\pi/2} \dfrac{\cos(x)}{1 + \sin^2(x)} dx  = \dfrac{\pi}2 \cdot \int_{-1}^1 \dfrac{dt}{1+t^2} = \dfrac{\pi}2 \cdot \left( \dfrac{\pi}4 - \dfrac{-\pi}4\right) = \dfrac{\pi^2}4$$
The integral you are after is $-I$ and hence the answer is $-\dfrac{\pi^2}4$.
A: Another approach, using integration by parts and symmetry about $\pi/2$:
$$
\begin{align}
\int_0^\pi\frac{x\sin(x)}{1+\cos^2(x)}\,\mathrm{d}x
&=-\int_0^\pi x\,\mathrm{d}\arctan(\cos(x))\tag{1a}\\
&=\left.-x\arctan(\cos(x))\,\vphantom{\int}\right|_0^\pi+\int_0^\pi \arctan(\cos(x))\,\mathrm{d}x\tag{1b}\\
&=\frac{\pi^2}4\tag{1c}
\end{align}
$$
Explanation:
$\text{(1a)}$: prepare to integrate by parts
$\text{(1b)}$: integrate by parts
$\text{(1c)}$: substitute $x\mapsto\pi-x$ to see that $\int_0^\pi\arctan(\cos(x))\,\mathrm{d}x=0$
A: $$I=\int_0^{\pi} \frac{-x\sin x}{1+\cos^2 x}\,dx=\int_0^{\pi} \frac{(x-\pi)\sin x}{1+\cos^2 x}dx\quad(x\to \pi-x)$$
$$\Rightarrow I=\frac{\pi}{2}\int_0^{\pi}\frac{-\sin x}{1+\cos^2 x}\,dx$$
Let $t=\cos x:$
$$I=\frac{\pi}{2}\int_{-1}^{1}-\frac{1}{1+t^2}\,dt=-\frac{\pi^2}{4}$$
A: Let $y=x-\frac{\pi}{2}$.
\begin{array}{l}\displaystyle  \int_{0}^{\pi} \frac{x \sin x}{1+\cos ^{2} x} d x&=\displaystyle \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\left(y+\frac{\pi}{2}\right) \cos y}{1+\sin ^{2} y} d y\\&=\displaystyle \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{y \cos y}{1+\sin ^{2} y} d y +\frac{\pi}{2} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\cos y}{1+\sin ^{2} y} d y
\\\displaystyle  &=\displaystyle \pi \int_{0}^{\frac{\pi}{2}} \frac{d(\sin y)}{1+\sin ^{2} y}
\\&=\displaystyle 0+\pi\left[\tan ^{-1}(\sin y)\right]_{0}^{\frac{\pi}{2}}\\&=\displaystyle \frac{\pi^{2}}{4} \end{array}
Hence
$$\int_{\pi}^{0} \frac{x \sin x}{1+\cos ^{2} x} d x =-\frac{\pi^2}{4}$$
