Improper integral of $\int_{0}^{\infty} \frac{x^p}{1+x}dx$ with$ -1I have a question, I need to solve the following equation:
$\int \limits_0^\infty \frac{x^p}{1+x}dx$
I can see that $x^p$ can be rewritten using $q\equiv -p$:
$\int \limits_0^\infty \frac{1}{x^q(1+x)}dx, 0<q<1$
There are two singularities, at $z=0$ and $z=-1$. Only $z=0$ is on the path, but what would be the best way to tackle this problem? I am stuck from here on...
 A: Let rewrite the integral as
$$
\int_0^\infty\frac {x^{-p}}{1+x}dx,
$$
where $p$ is a real number. The integral converges if and only if $0<p<1$.
Now consider the following transformations:
$$\begin{align}
\int_0^\infty\frac {x^{-p}}{1+x}dx&=\int_0^1+\int_1^\infty\frac {x^{-p}}{1+x}dx\tag1\\
&=\int_0^1\frac {x^{-p}+x^{p-1}}{1+x}dx\tag2\\
&=\int_0^1(x^{-p}+x^{p-1})\left(\sum_{n\ge0}(-x)^n\right)dx\tag3 \\
&=\sum_{n\ge0}(-1)^n\int_0^1(x^{-p+n}+x^{p-1+n})dx\tag4\\
&=\sum_{n\ge0}(-1)^n\left[\frac1{-p+n+1}+\frac1{p+n}\right]\tag5\\
&=\sum_{n\ge0}\left[\frac{(-1)^{-n-1}}{p-n-1}+\frac{(-1)^n}{p+n}\right]\tag6\\
&=\sum_{n=-\infty}^\infty\frac{(-1)^n}{p+n}.\tag7
\end{align}$$
It can be proved in various ways that:
$$
\sum_{n=-\infty}^\infty\frac{(-1)^n}{p+n}=\frac\pi{\sin\pi p}.\tag8
$$
The simplest way is probably to use the Mittag-Leffler's theorem. Indeed both expressions in $(8)$ considered as functions of $p$ have the same set of simple poles at $p=n$ with residues $(-1)^n$.

Explanations:
$(1)\to(2)$: substitution $x\mapsto\frac1x$ into the second integral.
$(2)\to(3)$: geometric series expansion of $\frac1{1+x}$ $(0<x<1)$.
$(3)\to(4)$: the order of integration and summation are interchanged.
$(4)\to(5)$: powers are integrated (observe that both $-p+n+1$ and $p+n$ are positive for $n\ge0$).
$(5)\to(6)$: the factor $(-1)^n$ is moved to fractions. the numerator and denominator of first fraction are then negated.
$(6)\to(7)$: reindexing.

A: Here is a very effective approach using integration in the complex plane. Let choose the branch cut of the function $z^{p}$ along the positive real semi-axis and consider the following integration contour $\Gamma$:
$$\begin{align}
&1)\;z=x,& x:0\to R\\
&2)\;z=Re^{i\phi},&\phi:0\to 2\pi\\
&3)\;z=x,& x:R\to0
\end{align}$$
The integral of the function
$$
f(z)=\frac{z^{p}}{1+z}
$$
over the circle vanishes as $R\to\infty$ due to Jordan's lemma. While on the top of the branch cut the function evaluates to $$\frac{x^{p}}{1+x}$$ on the bottom of the cut it is $$\frac{(xe^{i2\pi})^{p}}{1+x}=e^{i2\pi p}\frac{x^{p}}{1+x}.$$ 
Thus we have
$$\operatorname{Res}_{z=-1}f(z)=e^{i\pi p}=\frac1{2\pi i}
\int_{\Gamma}f(z)dz=\frac{1-e^{i2\pi p}}{2\pi i}\int_{0}^\infty\frac{x^{p}}{1+x}dx
$$
or
$$\int_{0}^\infty\frac{x^{p}}{1+x}dx=\frac{2\pi i\; e^{i\pi p} }{1-e^{i2\pi p}}
=-\frac\pi{\sin\pi p}.
$$
