I am trying to find the integral $$\int_0^\infty\frac{x^{p-1}}{1+x}\;\mathbb{d}x$$
I know that this is easily expressible in terms of beta function. But i need to prove that it's value is $\dfrac{\pi}{\sin{p\pi}}$ using a good contour I guess.
I tried of taking a counter like that of a keyhole having.
Sorry for bad drawing.
But I have no idea how to continue. P.S.: I am little weak at complex integrals. The contour has 1 semicircle of $\epsilon_1$ radius around $x=-1$ and two of those at $x=0$ where $R\to\infty$ and $\epsilon_1,\epsilon_2,\epsilon_3 \to 0$


There is no contour for the function as it is in the question, since $p-1$ is a real number in the interval $(-1,0).$ If $p-1$ is rational we have a multivalue function with as many values as the denominator of $p-1$ and this implies to create some brunch cuts on the contour. If $p-1$ is irrational then there are an infinte number of multivalues. Hence we want to change the integrand to somethig more friendly. This is the case of substitution by exponentials as shown here:
It is interesting that \begin{eqnarray*} \Gamma(x) \Gamma(1-x) = \mathrm{B}(x, 1-x) = \int_0^{\infty} \frac{s^{x-1} ds}{s+1} \end{eqnarray*} This identity is key to show the Euler's reflection formula
We show, by using contour integration, that
\begin{eqnarray*} \mathrm{B}(x, 1-x) = \frac{\pi}{\sin \pi x}. \end{eqnarray*} Observe that the Beta Function with $y=1-x$ yields the equation above.
Here is where we need to use contour integrals. We first make the substitution $s=e^t$, $ ds = e^t dt$, and $t \in (-\infty, \infty)$. So we need to compute
We compute \begin{eqnarray*} \mathrm{B}(x, 1-x) = \int_{-\infty}^{\infty} \frac{\mathrm{e}^{t(x-1)} \mathrm{e}^t dt}{\mathrm{e}^t+1} = \mathrm{B}(x, 1-x) = \int_{-\infty}^{\infty} \frac{\mathrm{e}^{tx} dt}{\mathrm{e}^t+1} \quad , \quad 0 < x < 1. \end{eqnarray*}
Let us consider the contour integral
\begin{eqnarray} I = \int_C f(z) dz, \label{intC} \end{eqnarray} with \begin{eqnarray*} f(z) = \frac{\mathrm{e}^{zx}}{\mathrm{e}^z+1} \quad , \quad 0 < x < 1. \end{eqnarray*} and $C$ is the contour that we need to determine. In the complex plane, the poles of the integrand are the roots of $e^z+1$, that is $\mathrm{e}^z = -1 = \mathrm{e}^{(2k+1) \mathrm{i} \pi}$ so the roots are $z_k= (2k+1) \mathrm{i} \pi$, for $k=0, \pm 1, \pm 2, \cdots$. Then $f(z)$ as an infinite number of poles all lying on the imaginary axis. We will select a contour that has only one pole as shown in the figure below. The contour $C$ can be seen as the union of $C=C_1 \cup C_2 \cup C_3 \cup C_4$, where $C_1$ and $C_3$ are horizontal lines from $-R$ to $R$ with opposite orientation. We want to let $R$ grow to $\infty$. The paths $C_2$ and $C_4$ are vertical lines between $0$ and $2 \pi \mathrm{i}$ with opposite orientations showed in the figure below
From the
Residue Theorem we evaluate the integral over $C$. The residue corresponding to the pole $z_0= \pi \mathrm{i}$, is computed using the exprsession
\begin{eqnarray*} \lim_{z \to z_0} (z-z_0) \, f(z) = \lim_{z \to z_0} \frac{ (z-z_0) \mathrm{e}^{z x}} {\mathrm{e}^z + 1} = \lim_{z \to z_0} \frac{\mathrm{e}^{zx} + (z-z_0) \mathrm{e}^{zx}}{e^z} = \mathrm{e}^{z_0 (x-1)}. \end{eqnarray*} where we use L'H\^{o}pital's rule.
Hence $I = 2 \pi \mathrm{i} \; \mathrm{e}^{\pi i (x-1)}$ since the only residue inside the contour is at $z=\mathrm{i} \pi$ . That is,
\begin{eqnarray*} 2 \pi \; \mathrm{i} \; \mathrm{e}^{ \mathrm{i} \pi (x-1)} =\int_{C_1} f(z) dz + \int_{C_2} f(z) dz + \int_{C_3} f(z) dz + \int_{C_4} f(z) dz . \end{eqnarray*}
We want to find $I_1=\int_{C_1} f(z) dz$, as $R \to \infty$. Let us first find the integral along the vertical path $C_3$.
\begin{eqnarray*} I_3 &=& \int_R^{-R} \frac{\mathrm{e}^{ (t + 2 \pi \mathrm{i} ) x}}{\mathrm{e}^{t+2 \pi \mathrm{i}} + 1 } d t \\ &=& \mathrm{e}^{2 \pi \mathrm{i} x} \int_R^{-R} \frac{\mathrm{e}^{ t x}}{\mathrm{e}^{t+2 \pi \mathrm{i}} + 1 } d t \\ &=& \mathrm{e}^{2 \pi \mathrm{i} x} \int_R^{-R} \frac{\mathrm{e}^{ t x}}{\mathrm{e}^{t} + 1 } d t \\ &=& -\mathrm{e}^{2 \pi \mathrm{i} x} I_1, \end{eqnarray*} where we reversed the sign since $I_1$ is computed from $-R$ to $R$ instead of going in the opposite direction.
The integral $I_2$ along the path $C_2$ is evaluated as follows \begin{eqnarray*} I_2 = \int_0^{2 \pi} \frac{\mathrm{e}^{ (R + \mathrm{i} t ) x}} {\mathrm{e}^{R+\mathrm{i} t} + 1 } d t = \frac{\mathrm{e}^{R x} }{\mathrm{e}^R} \int_0^{2 \pi} \frac{\mathrm{e}^{ (\mathrm{i} t ) x}} {\mathrm{e}^{\mathrm{i} t} + 1/\mathrm{e}^{R} } d t = \mathrm{e}^{R(x-1)} \int_0^{2 \pi} \frac{\mathrm{e}^{ (\mathrm{i} t ) x}} {\mathrm{e}^{\mathrm{i} t} + 1/\mathrm{e}^{R} } d t. \end{eqnarray*} Now, since $0 < x < 1$ (so $x-1 < 0)$, and the last integral is bounded we have that $\lim_{R \to \infty} I_2 = 0$. The same argument applies for the integral $I_4$ along the path $C_4$. We then have that, from $I=I_1+I_2+I_3+I_4$,
\begin{eqnarray*} 2 \pi \mathrm{i} \mathrm{e}^{\mathrm{i} \pi (x-1)} = (1 - \mathrm{e}^{2 \pi \mathrm{i} x}) I_1 \end{eqnarray*} and
\begin{eqnarray*} I_1 = \int_{0}^{\infty} \frac{s^{x-1} ds}{s+1} = \frac{ 2 \pi \mathrm{i} \mathrm{e}^{ \mathrm{i} \pi (x-1)}}{1 - \mathrm{e}^{2 \pi \mathrm{i} x}} = \frac{ \pi}{ \frac{\mathrm{e}^{\mathrm{i} \pi x} - \mathrm{e}^{-\mathrm{i} \pi x}}{2 \mathrm{i}}} = \frac{\pi}{\sin \pi x}. \end{eqnarray*}