Evaluate $\int\limits_0^\pi \frac{x}{1+\sin^2x} \ dx$
First, make the substitution $x\to \pi - x$ to get $$\int_{0}^{\pi} \frac{x}{1+\sin^2 x} \, dx = \frac{\pi}{2} \int_{0}^{\pi} \frac{1}{1+\sin^2 x} \, dx $$ Now, interpret the integral on the right as the area under a polar curve: set $r(\theta) = \frac{1}{\sqrt{1+\sin^2 \theta}}$. Converting this to Cartesian coordinates gives the ellipse $x^2 + 2y^2 = 1$. The area under this ellipse as the angle varies from $0$ to $\pi$ is $\frac{\pi}{2\sqrt{2}}$. Thus, $$\frac{1}{2} \int_{0}^{\pi} \frac{1}{1+\sin^2 x} \, dx = \frac{1}{2} \int_{0}^{\pi} r^2 \, d\theta = \frac{\pi}{2\sqrt{2}} \implies \int_{0}^{\pi} \frac{1}{1+\sin^2 x} \, dx= \frac{\pi}{\sqrt{2}}$$ Therefore, $$\int_{0}^{\pi} \frac{x}{1+\sin^2 x} \, dx = \frac{\pi^2}{2\sqrt{2}}$$
let $x = -u +\dfrac{\pi}{2}$, then $\sin^2x = \sin^2(-u +\frac{\pi}{2}) = \cos^2u$, and also $dx = -du$. So:
$I = \displaystyle \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \dfrac{\frac{\pi}{2} - u}{1 + \cos^2u}du = \pi\cdot \displaystyle \int_{0}^\frac{\pi}{2} \dfrac{1}{1 + \cos^2u}du$.
At this point you can introduce $t = \tan\left(\dfrac{u}{2}\right)$, and continue the fraction decomposition to finish it.