TITLE: Evaluating this integral for different values of a constant
QUESTION [12 upvotes]: 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?

REPLY [3 votes]: This is a special case of this question to which I gave this answer 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$.