Question: As you helped me so well last time, I might as well ask a final question!
Today I'm trying to prove this:

$$
\int\_0^\infty \frac{x^{p}}{ 1+x^{2}}dx = \frac{\pi}{2}\cos\left(p\frac{\pi}{2}\right)
$$

For $-1 < p < 1$.

I have no idea how to handle the varying $p$. I've been able to prove the relationship in the case $p = 0$. So now I could try showing this for $-1 < p < 0$ and $0 < p < 1$ but both of those seem to be tricky. 

Any tips on dealing with the non-constant $p$?
There are poles at $x = i$ and $x = -i$, and if $p < 0$ also at $x = 0$.

I think the best approach would be a semicircle in the top half, maybe with a small inner radius as well in the case $p<0$?
Or should I not be trying to prove the relationship for these separate parts but is there a general way to do it?

Answer: 
Let 
$$
I:(-1,1) \to \mathbb{R},\ I(p)=\int\_0^\infty\frac{x^p}{1+x^2}dx.
$$
For every $p \in (-1,0]$ one has $-p \in [0,1)$, and setting $t=x^{-1}$ one gets that
$$
I(-p)=\int\_0^\infty\frac{x^{-p}}{1+x^2}dx=\int\_0^\infty\frac{t^{p-2}}{1+t^{-2}}dt=\int\_0^\infty\frac{t^p}{1+t^2}=I(p).
$$
It is therefore enough to compute $I(p)$ for $p \in [0,1)$. 

We have
$$
I(0)=\int\_0^\infty\frac{1}{1+x^2}dx=\arctan x\big|\_0^\infty=\frac{\pi}{2}.
$$
From now on $0<p<1$. Denote by $g: \mathbb{C} \to \mathbb{C}$ the principal value of the multiple-valued function $\mathbb{C} \to \mathbb{C}, z \mapsto z^p$, and define
$$
f: \mathbb{C} \to \mathbb{C},\ f(z)=\frac{g(z)}{1+z^2}.
$$
Let $D\_R=\{z=x+iy \in \mathbb{C}:\ |z| \le R,\ y \ge 0\}$ with $R>1$. Thanks to the Residue Theorem we have
$$\tag{1}
\int\_{\partial D\_R}f(z)dz=2i\pi\text{Res}(f,i)=\pi g(i)=\pi e^{ip\pi/2}.
$$
Since $R>1$, setting $\partial D\_R=[-R,R]\times0\cup C\_R$, we have
$$
\left|\int\_{C\_R}f(z)dz\right|\le \int\_0^\pi R|f(Re^{i\theta})|d\theta \le \pi\frac{R^{p+1}}{R^2-1},
$$
and so
$$\tag{2}
\lim\_{R\to \infty}\int\_{C\_R}f(z)dz=0.
$$
Since
$$
\int\_{-R}^Rf(z)dz=\int\_0^Rf(x)dx+\int\_0^Rf(-z)dz=(1+e^{ip\pi})\int\_0^Rf(x)dx,
$$
it follows from (1) that
$$
\int\_0^Rf(x)dx=(1+e^{ip\pi})^{-1}\int\_{-R}^Rf(z)dz=(1+e^{ip\pi})^{-1}\left[\pi e^{ip\pi/2}-\int\_{C\_R}f(z)dz\right].
$$
In virtue of (2) we get
$$
I(p)=\pi\frac{e^{ip\pi/2}}{1+e^{ip\pi}}=\frac{\pi}{2\cos(p\pi/2)}.
$$
This is a special case of [this question](https://math.stackexchange.com/questions/110457/closed-form-of-integral) to which I gave [this answer](https://math.stackexchange.com/a/176216) which says
$$
\int\_0^\infty\frac{x^n}{1+x^m}\,\mathrm{d}x=\frac{\pi}{m}\csc\left(\pi\frac{n+1}{m}\right)
$$
for all real $m>0$ and $-1<n<m-1$.