Evaluate $\int _0 ^ \pi \frac{x}{1+\sin^2(x)} dx $ 
Find the value of
  $$\int _0 ^ \pi \dfrac{x}{1+\sin^2(x)} dx $$

I have tried using $\int_a ^bf(x) dx=\int_a^b f(a+b-x)dx$
$\displaystyle \int _0 ^ \pi \dfrac{x}{1+\sin^2(x)} dx=\int _0 ^ \pi \dfrac{\pi-x}{1+\sin^2(x)} dx=I$
I couldn't go any further with that!
 A: Now add the two integrals to get
$$2I=\pi\int_0^{\pi}\frac{dx}{1+\sin^2x}=\pi\int_{0}^{2\pi}\frac{dy}{3-\cos y},\tag{1}$$
where we used $\cos2x=1-2\sin^2x$ and the change of variables $y=2x$ to get the second equality.
The last integral in (1) can be easily calculated by residues (in fact the integrals of this type are the most standard and straightforward application of the residue theorem) so that finally
$$I=\frac{\pi^2}{2\sqrt{2}}.$$

Added: (the computation of (1) without residues) The change of variables $t=\tan x$ allows to write
$$\sin^2x=\frac{t^2}{1+t^2},\qquad dx=\frac{dt}{1+t^2},$$
so that 
\begin{align}
\int_0^{\pi}\frac{dx}{1+\sin^2x}=2\int_0^{\pi/2}\frac{dx}{1+\sin^2x}=2
\int_0^{\infty}\frac{dt}{1+2t^2}=\sqrt{2}\Bigl[\arctan(t\sqrt{2})\Bigr]_{0}^{\infty}
=\frac{\pi}{\sqrt{2}}.
\end{align}
A: Now, note that $$ \left( \displaystyle\int_0^\pi \dfrac {\pi}{1+\sin^2(x)} \, \mathrm{d}x \right) - I = I \implies I = \dfrac {\displaystyle\int_0^\pi \dfrac {\pi}{1+\sin^2(x)} \, \mathrm{d}x}{2}. $$
Try to find $ \displaystyle\int_0^\pi \dfrac {1}{1+\sin^2(x)} \mathrm{d}x $. 
A: You are almost there
$$2I=I+I= \displaystyle \int _0 ^ \pi \dfrac{x}{1+\sin^2(x)} dx+\int _0 ^ \pi \dfrac{\pi-x}{1+\sin^2(x)} dx=\pi\int _0 ^ \pi \dfrac{1}{1+\sin^2(x)} dx$$
The last integral can be calculated with the substitution $t =\tan(\frac{x}{2})$ or by writing $\sin(x)=\frac{1}{\csc(x)}$ (but be carefull as $\csc(x)$ is not defined at $0, \pi$).
A: $I$ =$\int _0 ^ \pi \dfrac{x}{1+\sin^2(x)} dx$
also $\int _0 ^ \pi \dfrac{\pi-x}{1+\sin^2(x)} dx=I$
add both to get,
$2I$ =  $\int _0 ^ \pi \dfrac{\pi}{1+\sin^2(x)} dx$
AND FURTHER SOLVE IT.
