Principal value of $\int_0^\infty \frac{x^{-p}}{x-1}dx$ for $|p|<1$ If $|p|<1$, how to find the Cauchy Principal Value of $$\int_0^\infty \frac{x^{-p}}{x-1}dx$$
I tried spliting the integration from $0\to 1$ and $1 \to \infty$ and switching $x = 1/u$, but no luck getting desired result which the book says is $ \pi \cot p \pi$. Please help.
ADDED:: using above method I got $\displaystyle \sum_{k=0}^\infty \left( \frac{1}{k + p} + \frac{1}{p - (k+1)} \right) $, it turned out to be $p \cot p\pi$ from Mathematica, anyone any ideas?
ADDED:: It seems that $$\displaystyle \sum_{k=0}^\infty \left( \frac{1}{k + p} + \frac{1}{p - (k+1)} \right)  = \sum_{k=-\infty}^\infty \frac{1}{k +p} = - \text{Res}[ \pi \cot(z \pi)/(p+z), z=-p] = \pi \cot p\pi$$
Also I was having trouble doing this via contour. Is this the shape of contour?

 A: Note: we must restrict $p$ to $p \in (0,1)$ for the Cauchy PV of the integral to converge at infinity.
The idea is to consider an integral in the complex plane and use Cauchy's theorem.  That is, if we define a contour $C$ within which there are no poles, we have
$$\oint_C dz \frac{z^{-p}}{z-1} = 0$$
$C$ will take the form of a keyhole contour, except that we will indent with a semicircle about the singularity at $z=1$ each time we make a pass along the real axis.  Thus, the above contour integral is broken up into $8$ pieces:
$$\oint_C dz \frac{z^{-p}}{z-1} = \int_{\epsilon}^{1-\epsilon} dx \frac{x^{-p}}{x-1} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{(1+\epsilon e^{i \phi})^{-p}}{\epsilon e^{i \phi}} + \int_{1+\epsilon}^{R} dx \frac{x^{-p}}{x-1} +  \\i R \int_{0}^{2 \pi} d\phi \, e^{i \phi} \frac{R^{-p} e^{-i p \phi}}{R e^{i \phi}-1} + e^{-i 2 \pi p}\int_{R}^{1+\epsilon} dx \frac{x^{-p}}{x-1} + \\  i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{(e^{i 2 \pi}+\epsilon e^{i \phi})^{-p}}{\epsilon e^{i \phi}} + e^{-i 2 \pi p} \int_{1-\epsilon}^{\epsilon} dx \frac{x^{-p}}{x-1} + \\ i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\epsilon^{-p} e^{-i p \phi}}{\epsilon e^{i \phi}-1} $$
Note that when we make the second pass along the real axis, we exploit the fact that we have traversed $2 \pi$ in argument, so we parametrize the real line using $z=x\, e^{i 2 \pi}$.  The multivaluedness of the integrand produces the nontrivial result we seek.
We take the limit as $\epsilon \to 0$ and $R \to \infty$.  The integrals over $x$ combine to form a factor times the Cauchy PV we seek.  The fourth and eighth integrals vanish in this limit because of the restriction over the value of $p$.  We are then left with the integrals over the bumps which do not vanish.  We thus have, after some simplification:
$$\left ( 1-e^{-i 2 \pi p}\right ) PV \int_0^{\infty} dx \frac{x^{-p}}{x-1} - i \pi \left ( 1+e^{-i 2 \pi p}\right ) = 0$$
Note that the second term comes from evaluating the second and sixth integrals and combining, while the first term comes from combining the first, third, fifth, and seventh integrals.  
Solving for the Cauchy principal value, we get
$$PV \int_0^{\infty} dx \frac{x^{-p}}{x-1} = i \pi \frac{1+e^{-i 2 \pi p}}{1-e^{-i 2 \pi p}} = \pi \cot{\pi p}$$
A: Though Ron Gordon was here first, let me describe another (hopefully simpler) approach.

Complete the contour of integration for principal value (i.e. $(0,1-\epsilon)\cup(1+\epsilon,\infty)$) by a half-circle of radius $\epsilon$ in the upper half-plane (centered at $1$). This adds  $-i\pi$ to the initial integral.
Next rotate the integration contour by $\pi$ counterclockwise so that it becomes the negative real axis. The integral then transforms into
$$e^{-i\pi p}\int_{0}^{-\infty}\frac{(-x)^{-p}d(-x)}{(-x)+1}=e^{-i\pi p}\int_{0}^{\infty}\frac{y^{-p}dy}{y+1}=e^{-i\pi p}\frac{\pi}{\sin\pi p}.$$
Therefore the initial principal value integral is equal to
$$e^{-i\pi p}\frac{\pi}{\sin\pi p}+i\pi=\pi \cot\pi p.$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
With $\ds{\Re\pars{p} \in \pars{0,1}}$:
\begin{align}
&\bbox[5px,#ffd]{\mrm{P.V.}\int_{0}^{\infty}{x^{-p} \over
x - 1}\,\dd x} =
\Re\int_{0}^{\infty}{x^{-p} \over x - 1 + \ic 0^{+}}\,\dd x
\\[5mm] = &\
-\,\Re\int_{\infty}^{0}{\ic^{-p}\,y^{-p} \over
\ic y - 1 + \ic 0^{+}}\,\ic\,\dd y =
\Im\bracks{\ic^{-p}\int_{0}^{\infty}
{y^{\pars{\color{red}{1 - p}} - 1} \over 1 - \ic y}\,\dd y}
\end{align}
I'll evaluate the last integral with Ramanujan's Master Theorem: Note that
$\ds{{1 \over 1 - \ic y} =
\sum_{k = 0}^{\infty}\pars{\ic y}^{k} =
\sum_{k = 0}^{\infty}\color{red}{\Gamma\pars{1 + k}\expo{-k\pi\ic/2}}
\,\,\,{\pars{-y}^{k} \over k!}}$.
Then,
\begin{align}
&\bbox[5px,#ffd]{\mrm{P.V.}\int_{0}^{\infty}{x^{-p} \over
x - 1}\,\dd x}
\\[5mm] = &\
\Im\bracks{\expo{-p\pi\ic/2}\,\,\Gamma\pars{\color{red}{1 - p}}
\Gamma\pars{1 - \bracks{\color{red}{1 - p}}}
\expo{\pars{\color{red}{1 - p}}\pi\ic/2}}
\\[5mm] = &\
\Im\bracks{\ic\expo{-p\pi\ic}\,{\pi \over \sin\pars{\pi p}}} =
\cos\pars{p\pi}\,{\pi \over \sin\pars{\pi p}}
\\[5mm] = &\
\bbx{\pi\cot\pars{\pi p}}\,,\qquad
\Re\pars{p} \in \pars{0,1} \\ &
\end{align}
