$\int_0^∞ \dfrac{x^a}{(x^2 + 1)^2} dx$ for $-1I tried to evaluate $A=\int_0^∞ \dfrac{x^a}{(x^2 + 1)^2} dx$ for $-1<a<3$, several times. I followed lengthy examples of the book which supposes real positive axis as branch cut. Every time I am getting $\pi a \cos{\frac{\pi a}{2}}$ but the book's answer (without steps) is $\dfrac{(1-a)}{4 \cos{\frac{\pi a}{2}}}.$ Please help!    
By limiting $\rho \to 0$ and $R \to \infty$ integral on circles vanishes:

So $$(1-e^{2 \pi a i})\int_0^∞ \dfrac{r^a}{(r^2 + 1)^2} dr = 2 \pi  i \sum Res_{z_0=i \ \text{and} \  z_0=-i} = \dfrac{\pi a}{2}(i^{a-1}+(-i)^{a-1})$$ which results $A=\pi a \cos{\frac{\pi a}{2}}$. 
This is an exercise 2 Sec. 84 Ch. 7 of the book Complex Variables by J Brown and R Churchill 8th ed. 
 A: Here, we evaluate the integral of interest by integrating the function $f(z)=\frac{z^a}{(1+z^2)^2}$ on the classical keyhole contour on which we choose the branch for which $0\le \arg(z)< 2\pi$.  

NOTE:  On this chosen branch $\displaystyle i=e^{i\pi /2}$ and $\displaystyle -i=e^{i3\pi/2}$. 

Proceeding, we find that for $a\ne 0,1,2$
$$\begin{align}
(1-e^{i2\pi a})\int_0^\infty \frac{x^a}{(1+x^2)^2}\,dx&=2\pi i \text{Res}\left(\frac{z^a}{(1+z^2)^2},z=\pm i\right)\\\\
&=2\pi i (1-a)\left(\frac{e^{i\pi a/2}}{4i}-\frac{e^{i3\pi a/2}}{4i}\right)\\\\
\int_0^\infty \frac{x^a}{(1+x^2)^2}\,dx&=(1-a)\frac{2\pi i \left(\frac{e^{i\pi a/2}}{4i}-\frac{e^{i3\pi a/2}}{4i}\right)}{1-e^{i2\pi a}}\\\\
&=\frac\pi2 (1-a)\frac{e^{i\pi a}(e^{-i\pi a/2}-e^{i\pi a/2})}{e^{i\pi a}(e^{-i\pi a}-e^{i\pi a})}\\\\
&=  \frac\pi 2 (1-a)\frac{\sin(\pi a/2)}{\sin(\pi a)}\\\\
&=  \frac\pi 2 (1-a)\frac{\sin(\pi a/2)}{2\sin(\pi a/2)\cos(\pi a/2)}\\\\
&=(1-a)\frac{\pi}{4\cos(\pi a/2)}
\end{align}$$
as was to be shown!

For $a=0$, $a=1$, or $a=2$, there is no branch point singularity and the keyhole contour does not apply.  Owing to the continuity in $a$, we can evaluate the integral by taking the limit of $(1-a)\frac{\pi}{4\cos(\pi a/2)}$ as $a$ approaches $0$, $1$, or $2$.

I thought it might be instructive to present a way forward using real analysis only.  To that end we write for $a\ne1$
$$\begin{align}
\int_0^\infty \frac{x^a}{(1+x^2)^2}\,dx&= \frac12 \int_0^\infty \frac{x^{(a-1)/2}}{(1+x)^2}\,dx\\\\
&=\frac12 B\left(\frac12(a+1),\frac12 (3-a) \right)\\\\
&=\frac12 \Gamma\left (\frac12(a+1) \right)\Gamma\left( \frac12 (3-a)\right)\\\\
&\overbrace{=}^{\Gamma(1+x)=x\Gamma(x)}\frac14(1-a) \Gamma\left(\frac12 (a+1)\right)\Gamma\left (\frac12(1-a)\right)\\\\
&\overbrace{=}^{\Gamma(x)\Gamma(1-x)=\pi/\sin(\pi x/2)}\frac14 (1-a)\frac\pi{\sin(\pi(1-a)/2)} \\\\
&=(1-a)\frac{\pi}{4\cos(\pi a/2)}
\end{align}$$
as expected!  The value for the case for $a=1$ is readily available in the expression before using the functional relationship for the Gamma function.
