<s>[INST] A problem with $\int_0^{\infty} \frac{x^a}{(1-x)^2} \ \mathrm dx$ I want to evaluate:
$\displaystyle \tag*{} I = \int_0^{\infty} \frac{x^a}{(1-x)^2} \ \mathrm dx$
Where $-1<a<1$. I tried to split the integral at $x=1$
$\displaystyle \tag*{}I= \int_0^1 \frac{x^a}{(1-x)^2} \ \mathrm dx +  \int_1^\infty \frac{x^a}{(1-x)^2} \ \mathrm dx $
However, both the integrals diverge. Now I chose $\epsilon$ such that $\epsilon \ll 1$. So
$\displaystyle \tag*{} I= \int_0^{1-\epsilon} \frac{x^a}{(1-x)^2} \ \mathrm dx +  \int_{1-\epsilon}^\infty \frac{x^a}{(1-x)^2} \ \mathrm dx$
Now, can anyone help me solve this? Is my steps correct at the first step? Any help would be appreciated.
 [/INST] New Answer. Let $0 < \varepsilon < 1$, and consider the integral
\begin{align*}
I_{\varepsilon} = \int_{0}^{1-\varepsilon} \frac{x^a}{(x-1)^2} \, \mathrm{d}x + \int_{1+\varepsilon}^{\infty} \frac{x^a}{(x-1)^2} \, \mathrm{d}x.
\end{align*}
To analyze the behavior of this integral, we consider the counter-clockwise contour as below:

Then, as $ R\to\infty $,
\begin{align*}
0
&= \lim_{R\to\infty} \oint_{\text{contour}} \frac{z^a}{(z-1)^2} \, \mathrm{d}z \\
&= I_{\varepsilon}
+ \int_{\gamma_{\varepsilon}} \frac{z^a}{(z-1)^2} \, \mathrm{d}z
+ \int_{-\infty}^{0} \frac{z^a}{(z-1)^2} \, \mathrm{d}z.
\end{align*}
From this, we get
\begin{align*}
I_{\varepsilon}
&= - \int_{-\infty}^{0} \frac{z^a}{(z-1)^2} \, \mathrm{d}z - \int_{\gamma_{\varepsilon}} \frac{z^a}{(z-1)^2} \, \mathrm{d}z \\
&= - \int_{0}^{\infty} \frac{(-t)^a}{(1+t)^2} \, \mathrm{d}t + \int_{0}^{\pi} \frac{(1+\varepsilon e^{i\theta})^a}{(\varepsilon e^{i\theta})^2} \, i \varepsilon e^{i\theta} \mathrm{d}\theta \\
&= - e^{i\pi a} \int_{0}^{\infty} \frac{t^a}{(1+t)^2} \, \mathrm{d}t + \frac{i}{\varepsilon} \int_{0}^{\pi} (1+\varepsilon e^{i\theta})^a e^{-i\theta} \, \mathrm{d}\theta.
\end{align*}
Using the binomial series and the identity $\int_{0}^{\infty} \frac{t^a}{(1+t)^2} \, \mathrm{d}t = \frac{\pi a}{\sin(\pi a)}$ together, we get
\begin{align*}
I_{\varepsilon}
&= - e^{i\pi a} \frac{\pi a}{\sin(\pi a)} + \frac{i}{\varepsilon} \sum_{n=0}^{\infty} \binom{a}{n} \int_{0}^{\pi} (\varepsilon e^{i\theta})^n e^{-i\theta} \, \mathrm{d}\theta \\
&= - e^{i\pi a} \frac{\pi a}{\sin(\pi a)} + \frac{i}{\varepsilon} \biggl[ 2 \varepsilon + i \pi a \epsilon - \sum_{k=1}^{\infty} \binom{a}{2k} \frac{2}{2k-1} \varepsilon^{2k} \biggr] \\
&= \bbox[border:2px #E0E0FF solid; padding:5px;]{\frac{2}{\varepsilon} - \frac{\pi a}{\tan (\pi a)} - \sum_{k=1}^{\infty} \frac{2 a(a-1)\cdots(a-2k+1)}{(2k)!(2k-1)}\varepsilon^{2k-1}}
\end{align*}
Old Answer. We first extract the contribution from the double pole at $x = 1$:
\begin{align*}
I_{\varepsilon}
&= \biggl[ \int_{0}^{1-\varepsilon} \frac{x^a - 1}{(x-1)^2} \, \mathrm{d}x + \int_{0}^{1-\varepsilon} \frac{1}{(x-1)^2} \, \mathrm{d}x \biggr] + \biggl[ \int_{1+\varepsilon}^{\infty} \frac{x^a-1}{(x-1)^2} \, \mathrm{d}x - \int_{1+\varepsilon}^{\infty} \frac{1}{(x-1)^2} \, \mathrm{d}x \biggr] \\
&= \int_{0}^{1-\varepsilon} \frac{x^a - 1}{(x-1)^2} \, \mathrm{d}x + \int_{1+\varepsilon}^{\infty} \frac{x^a - 1}{(x-1)^2} \, \mathrm{d}x + \frac{2}{\varepsilon} - 1.
\end{align*}
Next, substituting $x \mapsto 1/x$ in the second integral,
\begin{align*}
I_{\varepsilon}
= \int_{0}^{1-\varepsilon} \frac{x^a - 1}{(x-1)^2} \, \mathrm{d}x + \int_{0}^{\frac{1}{1+\varepsilon}} \frac{x^{-a} - 1}{(x-1)^2} \, \mathrm{d}x + \frac{2}{\varepsilon} - 1.
\end{align*}
By noting that $\frac{1}{1+\varepsilon} = 1-\varepsilon + \mathcal{O}(\varepsilon^2)$ as $\varepsilon \to 0^+$ and $\frac{x^{-a} - 1}{(x-1)^2} = \mathcal{O}(|x-1|^{-1})$ as $x \to 1$, we easily find that
\begin{align*}
I_{\varepsilon}
&= \int_{0}^{1-\varepsilon} \frac{x^a - 1}{(x-1)^2} \, \mathrm{d}x + \int_{0}^{\color{blue}{1-\varepsilon}} \frac{x^{-a} - 1}{(x-1)^2} \, \mathrm{d}x + \frac{2}{\varepsilon} - 1 + \mathcal{O}(\varepsilon) \\
&= \int_{0}^{1-\varepsilon} \frac{x^a + x^{-a} - 2}{(x-1)^2} \, \mathrm{d}x + \frac{2}{\varepsilon} - 1 + \mathcal{O}(\varepsilon) \\
&= \int_{0}^{\color{blue}{1}} \frac{x^a + x^{-a} - 2}{(x-1)^2} \, \mathrm{d}x + \frac{2}{\varepsilon} - 1 + \mathcal{O}(\varepsilon),
\end{align*}
where the last step follows from $x^a + x^{-a} - 2 = \mathcal{O}(|x-1|^2)$ as $x \to 1$. The last integral can be computed explicitly, yielding
$$ \int_{0}^{1} \frac{x^a + x^{-a} - 2}{(x-1)^2} \, \mathrm{d}x = 1 - \frac{\pi a}{\tan (\pi a)}. $$
Combining altogether, we obtain the following asymptotic formula
$$ \bbox[border:2px #E0E0FF solid; padding:5px;]{I_{\varepsilon} = \frac{2}{\varepsilon} - \frac{\pi a}{\tan (\pi a)} + \mathcal{O}(\varepsilon)} $$
as $\varepsilon \to 0^+$.
</s>