Integral $P\int_0^\infty \frac{x^{\lambda-1}}{1-x} dx$ I am trying to calculate the following principle value integral
\begin{equation}
P\int_0^\infty \frac{x^{\lambda-1}}{1-x} dx
\end{equation}
for $\lambda \in [0,1].$  I tried to turn this into a contour integral so our complex function is given by
$$
f(z)=\frac{z^{\lambda-1}}{1-z}
$$
which has a simple pole at $z=1$ and branch points at $z=0$ and $z=\infty$.  We integrate over a contour with two indented paths thus we pick up half residues at these two contours), thus we can write the contour C as
$$
C=\sum_{i=1}^6 C_i + C_{\epsilon}+C_{R}=C_1+C_2+C_3+C_4+C_5+C_6+C_{\epsilon}+C_R.
$$
Since the contour encloses no poles and $f(z)$ is holomorphic, by the Cauchy-Goursat theorem we know that
$$
\oint_C f(z) dz=0.
$$
I can show that the integrals of the contours $C_R$ and $C_\epsilon$ vanish since
$$
\bigg|\int_{C_R}\bigg| \leq \bigg| \int_{0}^{2\pi} d\theta \frac{R^{\lambda-1} R}{R} \bigg|=\bigg| \frac{2\pi}{R^{1-\lambda}}\bigg| \to 0 \ \text{as} \ R\to\infty \ \text{for} \ \lambda < 1
$$
and
$$
\bigg|\int_{C_\epsilon}\bigg| \leq \bigg| \int_{0}^{2\pi} d\theta \epsilon^{\lambda-1}\cdot \epsilon = \big|2\pi\epsilon^\lambda\big| \to 0 \ \text{as} \ \epsilon \to 0 \ \text{for} \ \lambda > 0.
$$
Now write the contour integral as
$$
0=\oint_C f(z)dz=P\int_{C_1}  + \ P\int_{C_2} +\  P\int_{C_3}+\ P\int_{C_4}+\ P\int_{C_5}+\ P\int_{C_6}.
$$
Explicitly we can now calculate three contour integrals over $C_1, C_2, C_3$ by using $z=xe^{2\pi i}$, $dz=dxe^{i2\pi}=dx$ and we obtain
\begin{equation}
P\int_{C_1}+\ P\int_{C_2}+\ P\int_{C_3}=\lim_{R\to\infty} \lim_{\epsilon \to 0}\int_{Re^{i(2\pi-\epsilon)}}^{(1+\epsilon)2\pi i} \frac{z^{\lambda-1}}{1-z}dz-\frac{1}{2}2\pi i\cdot Res_{z=e^{2\pi i} }[f(z)] +e^{2\pi i(\lambda-1)} \int_{1}^{0} \frac{x^{\lambda-1}}{1-x}dx.
\end{equation}
Note the first integral in terms of $z$ can just be written as
$$
\lim_{R\to\infty} \lim_{\epsilon \to 0}\int_{Re^{i(2\pi-\epsilon)}}^{(1+\epsilon)2\pi i} \frac{z^{\lambda-1}}{1-z}dz=\int_{\infty}^{1} \frac{x^{\lambda-1}}{1-x}dx
$$
however I am stuck as to how go from here.  Thanks
 A: I'll evaluate the more general case $$\text{PV} \int_{0}^{\infty} \frac{x^{\lambda-1}}{x^{b}-1} \ dx \ \ (b >\lambda > 0, \ b\ge 1) .$$
Let $ \displaystyle f(z) = \frac{z^{\lambda-1}}{z^{b}-1}$, where the branch cut is along the positive real axis.
Now integrate around a wedge of radius $R$ that makes an angle of $ \displaystyle \frac{2 \pi }{b}$ with the positive real axis and is indented around the simple poles at $z=1$ and $z=e^{2 \pi i /b}$, and the branch point at $z=0$.
The integral obviously vanishes along the arc of the wedge as $R \to \infty$.
And there is no contribution from the indentation around the branch point at $z=0$ since $$\Big| \int_{0}^{\frac{2 \pi}{b}} f(re^{it})  ire^{it}   \  dt \Big|  \le \frac{2 \pi}{b}   \frac{r^{\lambda}}{1-r^{b}} \to 0 \ \text{as} \ r \to 0.$$
Then going around the contour counterclockwise,
$$ \text{PV} \int_{0}^{\infty} f(x) \ dx - \pi i \ \text{Res} [f,  \pi i] +  \ \text{PV}\int_{\infty}^{0} f(te^{\frac{2 \pi i }{b}}) e^{\frac{2 \pi i}{b}} \ dt - \pi i \ \text{Res}[f,e^{\frac{2 \pi i}{b}}]  = 0 .$$
Looking at each part separately,
$$ \text{Res}[f,1] = \lim_{z \to 1} \frac{z^{\lambda-1}}{bz^{b-1}} = \frac{1}{b}$$
$ $
$$\text{PV} \int_{\infty}^{0} f(te^{\frac{2 \pi i }{b}}) e^{\frac{2 \pi i}{b}} \ dt = - e^{\frac{2 \pi i}{b}} \text{PV} \int_{0}^{\infty} \frac{t^{\lambda-1} e^{\frac{2 \pi i(\lambda-1)}{b}}}{t^{b} e^{2 \pi i} - 1} \ dt = - e^{\frac{2 \pi i \lambda}{b}} \text{PV} \int_{0}^{\infty} \frac{t^{\lambda-1}}{t^{b}-1} \ dt $$
$ $
$$ \text{Res}[f, e^{\frac{2 \pi i}{b}}] = \lim_{z \to e^{\frac{2 \pi i}{b}}} \frac{z^{\lambda-1}}{bz^{b-1}} = \frac{e^{\frac{2 \pi i (\lambda-1)}{b}}}{b e^{\frac{2 \pi i(b-1)}{b}}} = \frac{1}{b} e^{\frac{2 \pi i \lambda }{b}} $$
Plugging back in and rearranging, 
$$\text{PV} \int_{0}^{\infty} \frac{x^{\lambda-1}}{x^{b}-1} \ dx = \frac{\pi i}{b} \frac{1 + e^{\frac{2 \pi i \lambda}{b}}}{1-e^{\frac{2 \pi i \lambda}{b}}} = - \frac{\pi}{b} \cot \left(\frac{\pi \lambda}{b} \right) $$
or
$$ \text{PV} \int_{0}^{\infty} \frac{x^{\lambda-1}}{1-x^{b}} \ dx =  \frac{\pi}{b} \cot \left(\frac{\pi \lambda}{b} \right) $$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x:\ {\large ?}\,,\qquad
     \lambda \in \pars{0,1}}$.

\begin{align}
&\color{#c00000}{\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}=
\lim_{\epsilon \to 0^{+}}\pars{%
\int_{0}^{1 - \epsilon}{x^{\lambda - 1} \over 1 - x}\,\dd x
\int_{1 + \epsilon}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}
\\[3mm]&=
\lim_{\epsilon \to 0^{+}}\bracks{%
\int_{0}^{1 - \epsilon}{x^{\lambda - 1} \over 1 - x}\,\dd x
+\int_{1/\pars{1 + \epsilon}}^{0}{\pars{1/x}^{\lambda - 1} \over 1 - 1/x}\,\pars{-\,{\dd x \over x^{2}}}}
\\[3mm]&=\lim_{\epsilon \to 0^{+}}\bracks{%
\int_{0}^{1 - \epsilon}{x^{\lambda - 1} \over 1 - x}\,\dd x
-\int^{1/\pars{1 + \epsilon}}_{0}{x^{-\lambda} \over 1 - x}\,\dd x}
\\[3mm]&=\lim_{\epsilon \to 0^{+}}\bracks{%
\int_{0}^{1 - \epsilon}{x^{\lambda - 1}  - x^{-\lambda} \over 1 - x}\,\dd x
-\int^{1/\pars{1 + \epsilon}}_{1 - \epsilon}{\dd x \over x^{\lambda}\pars{1 - x}}}
\\[3mm]&=\lim_{\epsilon \to 0^{+}}\bracks{%
\int_{0}^{1 - \epsilon}{1  - x^{-\lambda} \over 1 - x}\,\dd x
-\int_{0}^{1 - \epsilon}{1  - x^{\lambda - 1} \over 1 - x}\,\dd x
-\int^{1/\pars{1 + \epsilon}}_{1 - \epsilon}{\dd x \over x^{\lambda}\pars{1 - x}}}
\end{align}

However, $\ds{\lim_{\epsilon \to 0^{+}}\int^{1/\pars{1 + \epsilon}}_{1 - \epsilon}{\dd x \over x^{\lambda}\pars{1 - x}} = 0}$ because
\begin{align}
&\verts{%
\int^{1/\pars{1 + \epsilon}}_{1 - \epsilon}{\dd x \over x^{\lambda}\pars{1 - x}}}
\leq
\int^{1/\pars{1 + \epsilon}}_{1 - \epsilon}{\dd x
\over \pars{1 - \epsilon}^{\lambda}\bracks{1 - 1/\pars{1 + \epsilon}}}
\\[3mm]&={1 + \epsilon \over \pars{1 - \epsilon}^{\lambda}}
\bracks{{1 \over 1 + \epsilon} - \pars{1 - \epsilon}}
={\epsilon^{2} \over \pars{1  - \epsilon}^{\lambda}}
\end{align}

and, similarly,
  $\ds{\lim_{\epsilon \to 0^{+}}
\int^{1}_{1 - \epsilon}{x^{\lambda - 1}  - x^{-\lambda} \over 1 - x}\,\dd x = 0}$ such that
  \begin{align}
&\color{#c00000}{\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}
=
\int_{0}^{1}{1  - x^{-\lambda} \over 1 - x}\,\dd x
-\int_{0}^{1}{1  - x^{\lambda - 1} \over 1 - x}\,\dd x
=\Psi\pars{-\lambda + 1} - \Psi\pars{\lambda}
\end{align}
  where $\ds{\Psi\pars{z}}$ is the Digamma Function ${\bf\mbox{6.3.1}}$ and we used the
  identity ${\bf\mbox{6.3.22}}$.

With Euler Reflection Formula
${\bf\mbox{6.3.7}}$  $\pars{~\Psi\pars{1 - z} = \Psi\pars{z} + \pi\cot\pars{\pi z}~}$ we'll get:
$$
\color{#00f}{\large\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}
=\color{#00f}{\large\pi\cot\pars{\pi\lambda}}\,,\qquad\qquad \lambda \in \pars{0,1}
$$
A: Let the contour $\gamma$ be
$\hspace{3.6cm}$
Since $\gamma$ contains no singularities of $\dfrac{z^{\lambda-1}}{1-z}$, we get
$$
\int_\gamma\frac{z^{\lambda-1}}{1-z}\,\mathrm{d}z=0\tag{1}
$$
The integral along the large circle vanishes as the radius $\to\infty$ since the integrand $\sim-z^{\lambda-2}$.
The integral along the small upper semi-circle, as the radius $\to0$, is
$$
-\pi i\times\operatorname*{Res}\limits_{z=1}\dfrac1{1-z}=\pi i\tag{2}
$$
The integral along the small lower semi-circle, as the radius $\to0$, is
$$
-\pi i\times\operatorname*{Res}\limits_{z=1}\dfrac{e^{2\pi i(\lambda-1)}}{1-z}=\pi ie^{2\pi i(\lambda-1)}\tag{3}
$$
The integral along the upper line segments is
$$
\mathrm{PV}\int_0^\infty\frac{x^{\lambda-1}}{1-x}\,\mathrm{d}x\tag{4}
$$
The integral along the lower line segments is
$$
-e^{2\pi i(\lambda-1)}\mathrm{PV}\int_0^\infty\frac{x^{\lambda-1}}{1-x}\,\mathrm{d}x\tag{5}
$$
Summing $(2)-(4)$ and applying $(1)$ yields
$$
\begin{align}
\mathrm{PV}\int_0^\infty\frac{x^{\lambda-1}}{1-x}\,\mathrm{d}x
&=-\pi i\frac{1+e^{2\pi i(\lambda-1)}}{1-e^{2\pi i(\lambda-1)}}\\
&=\pi i\frac{e^{\pi i(\lambda-1)}+e^{-\pi i(\lambda-1)}}{e^{\pi i(\lambda-1)}-e^{-\pi i(\lambda-1)}}\\[9pt]
&=\pi\cot(\pi(\lambda-1))\\[15pt]
&=\pi\cot(\pi\lambda)\tag{6}
\end{align}
$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
Besides my previous answer, there is another way $\ds{\pars{~\mbox{in a "physicist fashion"}~}}$ to evaluate the
integral :

$\ds{\large\mbox{With}\quad {\tt\lambda \in \pars{0,1}}}$:
  \begin{align}
&\color{#c00000}{\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}
=-\Re\int_{0}^{\infty}{x^{\lambda - 1} \over x - 1 + \ic 0^{+}}\,\dd x
\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\pars{1}
\\[3mm]&=-\Re\left\lbrack -\
\overbrace{\left.\lim_{R \to \infty}\int_{0}^{2\pi}{z^{\lambda - 1} \over z - 1}
\,\dd z\,\right\vert_{z\ \equiv\ R\expo{\ic\theta}}}^{\ds{=\ 0}}\
-\ \int_{\infty}^{0}
{x^{\lambda - 1}\pars{\expo{2\pi\ic}}^{\lambda - 1} \over x - 1 - \ic 0^{+}}\,\dd x
\right.
\\[3mm]&\left.\phantom{-\Re\left\lbrack\right.\,\,\,}\mbox{}-\
\overbrace{\left.\lim_{\epsilon \to 0^{+}}\int^{0}_{2\pi}
{z^{\lambda - 1} \over z - 1}\,\dd z\,
\right\vert_{z\ \equiv\ \epsilon\expo{\ic\theta}}}^{\ds{=\ 0}}\right\rbrack
\\[3mm]&=-\Re\pars{\expo{2\pi\lambda\ic}\int^{\infty}_{0}
{x^{\lambda - 1} \over x - 1 - \ic 0^{+}}\,\dd x}
=-\Re\pars{\expo{2\pi\lambda\ic}\,\pp\int^{\infty}_{0}
{x^{\lambda - 1} \over x - 1}\,\dd x + \ic\pi\expo{2\pi\lambda\ic}}
\\[3mm]&=\cos\pars{2\pi\lambda}\,\color{#c00000}{\pp\int^{\infty}_{0}
{x^{\lambda - 1} \over 1 - x}\,\dd x} + \pi\sin\pars{2\pi\lambda}
\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\pars{2}
\end{align}

With $\pars{1}$ and $\pars{2}$, we get:
\begin{align}
&\color{#c00000}{\pp\int^{\infty}_{0}{x^{\lambda - 1} \over x - 1}\,\dd x}
=\pi\,{\sin\pars{2\pi\lambda} \over 1 - \cos\pars{2\pi\lambda}}
=\pi\,{2\sin\pars{\pi\lambda}\cos\pars{\pi\lambda} \over 2\sin^{2}\pars{\pi\lambda}}
=\pi\,{\cos\pars{\pi\lambda} \over \sin\pars{\pi\lambda}}
\end{align}

$$
\color{#00f}{\large\pp\int_{0}^{\infty}{x^{\lambda - 1} \over 1 - x}\,\dd x}
=\color{#00f}{\large\pi\cot\pars{\pi\lambda}}\,,\qquad\qquad \lambda \in \pars{0,1}
$$

