Calculate $\int_{-\pi}^{\pi} \frac{xe^{ix}} {1+\cos^2 {x}} dx$ So I'm trying to calculate 
$$
\int_{-\pi}^{\pi} \frac{xe^{ix}} {1+\cos^2 {x}}  dx
$$ 
knowing that if $f(a+b-x)=f(x)$ then $$
\int_{a}^{b} xf(x)dx=\frac{a+b}{2} \int_{a}^{b} f(x)dx,
$$
but it doesn't apply to $f(x) = \frac{e^{ix}}{1+\cos^2 x}$ so I tried separating the function and then using $t=\pi-x$ which does not work either because I still have that complex exponential $e^{i(a+b-x)}$ which isn't equal to $e^{ix}$...
Could you give me a hint ? 
 A: This can be written as
$$\int_{-\pi}^{\pi}\frac{x(\cos x+i\sin x)dx}{1+\cos^2 x}$$
$$=\int_{-\pi}^{\pi}\frac{x\cos xdx}{1+\cos^2 x}+i\int_{-\pi}^{\pi}\frac{x\sin xdx}{1+\cos^2 x}$$
The first integral evaluates to $0$ (Odd function) 
Whereas the second can be written as 
$$2i\int_{0}^{\pi}\frac{x\sin xdx}{1+\cos^2 x} \space\space\text{(even function)}$$
Next, let $$I=\int_{0}^{\pi}\frac{x\sin xdx}{1+\cos^2 x}$$replace $x\rightarrow \pi-x$
to get
$$I=\int_{0}^{\pi}\frac{(\pi-x)\sin xdx}{1+\cos^2 x}$$
And add the two, to get 
$$I=\frac{\pi}{2}\int_{0}^{\pi}\frac{\sin xdx}{1+\cos^2 x}$$
Now take $\cos x=t$ and you're done.
A: Hints/Ideas: $xe^{ix} = x\cos x + ix\sin x$, and you integrate on an interval symmetric around $0$.


*

*The function $x\mapsto \frac{x\cos x}{1+\cos^2 x}$ is odd, and the function $x\mapsto \frac{x\sin x}{1+\cos^2 x}$ is even.
$$
\int_{-\pi}^\pi f(x) dx = i\int_{-\pi}^\pi dx\frac{x\sin x}{1+\cos^2 x}
= 2i\int_{0}^\pi dx\frac{x\sin x}{1+\cos^2 x}
$$

*Now, integrate this by integration by parts, noticing that
$$
\arctan'(x) = \frac{1}{1+x^2}
$$
and therefore that
$$
\frac{d}{dx} \arctan\cos x = \frac{-2\sin x}{1+\cos^2 x}.
$$

Spoiler. (Details of step 2.)
Let $g=-\arctan \cos$.
$$\begin{align}
2\int_{0}^\pi dx\frac{x\sin x}{1+\cos^2 x}
&= 
\int_{0}^\pi x g'(x) dx
\stackrel{\rm(IPP)}{=} \left[xg(x)\right]^\pi_0
- \int_{0}^\pi g(x) dx
\\&
= -\pi\arctan(-1) - \int_{0}^\pi g(x) dx
= \pi\arctan(1) - \underbrace{\int_{0}^\pi g(x) dx}_{=0}
= \frac{\pi^2}{4}
\end{align}$$
where we used the fact that
$$
\int_{0}^\pi g(x) dx
= - \int_{0}^\pi \arctan \cos(x) dx
= -\int_{-1}^{1} \frac{\arctan u}{\sqrt{1-u^2}} du
= 0
$$
with the change of variables $u=\cos x$, and the fact that the integrand of the last integral is an odd function.
