Residue theorem for Multi-valued functions Im stuck with this problem
show that:
$$\int_0^\infty{\frac{x^a}{(x^2+1)^2}dx} = \frac{\pi (1-a)}{4cos(a \pi /2)}, \, -1<a<3, \, a \neq 1$$
I have the solution for it and everything but i don't understand the steps.
So instead of the real-valued integral stated above I am using 
$$\int_0^\infty{\frac{z^a}{(z^2+1)^2}dz} $$
with the singularities $z = \pm i$. Then i rewrite $z^a=e^{a[Log|z|+iArgz]}, \, 0<Argz<2 \pi$ but after that I'm stuck. 
In the solotion manual there is a factor $(1-e^{a2 \pi i})$ in front of the integral and I don't even know where it comes from, totally lost here.
 A: Ok after reading your question more carefully, i think you need a bit more advice then i gave in the comment. Consider the complex valued function
$$
f(z)=\frac{z^a}{(z^2+1)^2}
$$
For the actual application of the residue theorem, we choose a keyhole contour with a slit on positive real axis. This corresponds to a choice of the logarithm with $\lim_{\delta\rightarrow0^+}\log(x+i \delta)=\log(x)+ 0 i$ and $\lim_{\delta\rightarrow0^+}\log(x-i \delta)=\log(x)+2 \pi i$ if $x>0$
Therefore we obtain 
$$
\lim_{\delta\rightarrow0^+}f(x+i \delta)=\frac{x^a}{(x^2+1)^2}\\
\lim_{\delta\rightarrow0^+}f(x-i \delta)=e^{2\pi i a}\frac{x^a}{(x^2+1)^2}
$$
Now let's integrate: 
$$
\oint f(z)=i\lim_{R\rightarrow\infty}R\int_{\phi\in(0,2\pi)} d\phi e^{i\phi}f(Re^{i\phi})-i\lim_{\epsilon\rightarrow 0}\epsilon\int_{\phi\in(0,2\pi)} d\phi e^{i\phi} f(\epsilon e^{i\phi})+\\\int_{0}^{\infty}\frac{x^a}{(x^2+1)^2}+e^{2\pi ia}\int_{\infty}^{0}\frac{x^a}{(x^2+1)^2}=\\2\pi i (\text{res}(z=-i)+\text{res}(z=i))
$$
It is easy to show that the first two integrals over the big and small "circles" vanish. We are therefore left with
$$
\left(1-e^{2\pi ia}\right)\int_{0}^{\infty}\frac{x^a}{(x^2+1)^2}=2\pi i (\text{res}(z=-i)+\text{res}(z=i))
$$
Calculate the residues (be careful with your arguments!) and you are done

$$
\int_{0}^{\infty}\frac{x^a}{(x^2+1)^2}=\frac{\pi (1-a)}{4\cos(\pi \frac{a}{2})}
$$

after some simplification
Just for you to doublecheck:
The residues are
$$
\text{res}(z=-i)=\frac{1}{4}e^{i 3 \pi \frac{a}{2}}(a-1),\quad \text{res}(z=i)=\frac{1}{4}e^{ i \pi \frac{a}{2}}(a-1)
$$
A: For an alternative approach, replace $x$ with $\tan(\arcsin\sqrt{u})=\sqrt{\frac{u}{1-u}}$, then exploit Euler's beta function and the reflection formula for the $\Gamma$ function:
$$ \Gamma(z)\,\Gamma(1-z)=\frac{z}{\sin(\pi z)}.$$
