Finding integral $\int_{0}^{\infty} \frac{x^{\alpha}\log{x}}{1-x^2}dx$ using complex analysis - residues The problem I want to solve is:

Evaluate $$\int_{0}^{\infty} \frac{x^{\alpha}\log{x}}{1-x^2}dx,$$
where $0<\alpha<1$ using complex analysis.

I've learned several types of integrals involving $x^{\alpha}R(x)$ and $\log{x}R(x)$, where $R$ is a rational function. Also, I know how to solve certain integrals of the type $\int x^{\alpha}\log^{p}{x}R(x)dx$, using a method which is based on finding $\int x^{\alpha}R(x)dx$, and then differentiating with respect to $\alpha$. However, I can't use this method here, because $$\int_{0}^{\infty} \frac{x^{\alpha}}{1-x^2}dx$$ doesn't converge! I tried the following method: denote $f(z) = \frac{z^{\alpha}\log{z}}{1-z^2}$, and integrate $f(z)$ on the contour in the picture: 
Integrating $f$ over this contour, denote its boundary by $\partial D$, I get:
$$\int_{\partial D} f(z)dz = \int_{C_{R}} f(z)dz + (\int_{R}^{1+r} + \int_{1-r}^{\varepsilon}) \frac{e^{2\pi i \alpha}x^{\alpha}(\log{x}+2\pi i)}{1-x^2}dx + \int_{C_{r}} f(z)dz + \int_{C_{\varepsilon}} f(z)dz + (\int_{1+r}^{R} + \int_{\varepsilon}^{1-r}) \frac{x^{\alpha}\log{x}}{1-x^2}dx.$$
Here, $C_{R}$ is the large circle (minus a tiny part) in the picture, $C_{\varepsilon}$ is the tiny circle around $0$, and $C_{r}$ is the tiny circle around $1$ (minus tiny parts for both $C_{\varepsilon}$ and $C_{r}$). By Jordan's lemmas, the integral around $C_{R}$ goes to $0$ as $R \to +\infty$, as well as the integral around $C_{\varepsilon}$, while the integral around $C_{r}$ goes to $\pi^{2}e^{2 \pi i \alpha}$ as $r \to 0$. The $+2\pi i$ in the second integral is due to the branch of the logarithm, and the $e^{2 \pi i \alpha}$ is due to the branch of $z^{\alpha}$. Finally, I get:
$$ \int_{\partial D} f(z)dz = \int_{0}^{\infty} \frac{x^{\alpha}[(1-e^{2 \pi i \alpha})\log{x} - e^{2 \pi i \alpha}2 \pi i ]}{1-x^2}dx + \pi^{2}e^{2 \pi i \alpha}.$$
However, again, this integral does not converge.
Is there a way to repair this argument, or modify it a little bit, to get the solution?
EDIT: I forgot about the argument in the branch of $z^{\alpha}$, and due to that branch there's no need for $\log^{2}{z}$ in $f$, but I still can't use this method to find the integral for the same reason.
 A: OK, you have done all of the contour integration correctly.  Thus, all you really are missing is the fact that the "non-integrable" piece about which you are concerned is a Cauchy Principal Value, which is finite!  So, let
$$I = \int_0^{\infty} dx \, \frac{x^{\alpha} \log{x}}{1-x^2} $$
$$J = PV \int_0^{\infty} dx \, \frac{x^{\alpha}}{1-x^2} $$
where the $PV$ denotes a Cauchy Principal Value.  Now, the other piece you would need - and I assume you know how to do this - comes from the residue theorem.  Because I assume you know what you are doing, I will skip this evaluation and just write the equation resulting from the application of the theorem:
$$\left ( 1-e^{i 2 \pi \alpha} \right ) I - i 2 \pi e^{i 2 \pi \alpha} J + \pi^2 e^{i 2 \pi \alpha} = \pi^2 e^{i \pi \alpha} $$
Now, we just need to equate real and imaginary parts and we get two equations in two unknowns $I$ and $J$:
$$(1-\cos{2 \pi \alpha}) I + 2 \pi \sin{ 2 \pi \alpha} \, J = \pi^2 (\cos{\pi \alpha} - \cos{ 2 \pi \alpha} )$$
$$\sin{2 \pi \alpha}\, I + 2 \pi \cos{ 2 \pi \alpha} \, J = \pi^2 (\sin{2 \pi \alpha} - \sin{ \pi \alpha} )$$
You can then eliminate $J$ and solve for $I$.  The result is
$$I = \int_0^{\infty} dx \, \frac{x^{\alpha} \log{x}}{1-x^2} = -\pi^2 \frac{1-\cos{\pi \alpha}}{1-\cos{2 \pi \alpha}} = -\frac{\pi^2}{4 \cos^2{\left ( \frac{\pi}{2} \alpha \right )}}$$
You can also get $J$ if you want. 
A: You can solve this integral using differentiation w.r.t. the exponent by modifying the numerator using another parameter so that the singularity is not on the real axis. At the end of the computations when the logarithm has appeared, you can analytically continue that parameter to get back the the original denominator.
If we make the substitution $x^2 = t$, we get:
$$I = \frac{1}{4}\int_0^{\infty}\frac{t^{\frac{\alpha-1}{2}}\log(t)}{1-t}dt$$
We can calculate this integral using the standard integral:
$$\int_{0}^{\infty}\frac{x^{-p}}{1+x}dx =\frac{\pi}{\sin(\pi p)}\tag{1}$$
by differentiating w.r.t. $p$, which yields:
$$\int_{0}^{\infty}\frac{x^{-p}\log(x)}{1+x}dx =\frac{\pi^2\cos(\pi p)}{\sin^2(\pi p)}$$
The next step is to introduce a parameter in the denominator that allows us to  change the denominator to $x-1$. Let's substitute $x = t/r$ in the integral:
$$\int_{0}^{\infty}\frac{t^{-p}\left[\log(t)-\log(r)\right]}{r+t}dt =\frac{\pi^2\cos(\pi p)}{\sin^2(\pi p)}r^{-p}\tag{2}$$
Note here that taking $r=-1$ doesn't by itself do the job, as that would also change the integration interval from minus infinity to zero. What is needed instead is an analytic continuation to $r = -1$, which formally does look similar to doing the former. 
Substituting $x = t/r$ in (1) allows us to isolate the desired integral in (2):
$$\int_{0}^{\infty}\frac{t^{-p}\log(t)}{r+t}dt =\left[\frac{\pi^2\cos(\pi p)}{\sin^2(\pi p)}+\frac{\pi}{\sin(\pi p)}\log(r)\right]r^{-p}\tag{3}$$
This result is valid for positive real $r$, but we can analytically continue this to complex values. We can define logarithms and powers of $r$ by putting the branch-cut along the negative imaginary axis. Then $\log(r)$ for $r = u\exp(i\theta)$ for real positive $u$ is $\log(u) + i\theta$ where $\theta$ ranges from $-\frac{\pi}{2}$ to $\frac{3\pi}{2}$. And $r^p = u^p\exp(i\theta p)$ is also unambiguously defined. So, we can then put $r = -1$ by taking $u=1$ and  $\theta = \pi$. This yields:
$$\int_{0}^{\infty}\frac{t^{-p}\log(t)}{t-1}dt =\frac{\pi^2}{\sin^2(\pi p)}\tag{4}$$
And this yields the result:
$$I = \frac{1}{4}\int_0^{\infty}\frac{t^{\frac{\alpha-1}{2}}\log(t)}{1-t}dt = -\frac{\pi^2}{4\cos^2(\frac{\pi\alpha}{2})}$$
As an exercise you can verify that analytically continuing the other way around by taking the branch cut on, say, the positive imaginary axis, yields the same result. To set $r$ to $-1$, you then have to put $r = \exp(-i\pi)$.
If we instead try to analytically continue $r$ to some other point on the negative real axis, then the result will depend on which way around the branch point we move to get there. Unlike in the case of $r = -1$ which only produces a removable singularity, for other negative values, the integrand will have a pole. But since by Cauchy's theorem we're always free to deform the integration contour from 0 to infinity in any way we like as long as we don't cross any singularities, we can just make an indentation in the integration contour to make room for the pole that will arrive there. The way the integral then depends on $r$ won't have any singularities right until the point $r$ is put on the negative real axis. 
So, this is then clearly the correct analytic continuation. However, it's then also clear that if we analytically continue $r$ the other way around, the indentation in the contour will have to be made in the opposite direction. 
A: Note the real valued function $\dfrac{\log x}{x-1} \to -1$ as $x \to 1$ and also $x^{\alpha} \log x \to 0$ as $x \to 0^+.$ 
So the function $f(x) =  \dfrac{x^{\alpha}}{1+x}\dfrac{\log x}{1-x}$ has removable discontinuities at $0^+$ and $1$ and can be considered continuous on $0 \leq x < \infty$.
Choose any $0 < \epsilon < 1 < \delta$.
Then upon the substitution $x = e^t$ we have $$\int_{\epsilon}^{\delta} \dfrac{x^\alpha \log x}{1-x^2} dx = \int_{-\log(1/\epsilon)}^{\log \delta}\dfrac{te^{t(\alpha+1)}}{1-e^{2t}}dt.$$
Since $-\log(1/\epsilon) \to -\infty$ as $\epsilon \to 0^+$ and $\log \delta \to \infty$ as $\delta \to \infty$
it is sufficient to show the improper integral $$I=\int_{-\infty}^{\infty}\dfrac{te^{t(\alpha+1)}}{1-e^{2t}}dt\, \colon = \lim_{\substack{R\to\infty \\ S\to\infty}}\int_{-R}^{S}\dfrac{te^{t(\alpha+1)}}{1-e^{2t}}dt$$ exists, and if it does then its value $I$ is the required answer. 
Consider the complex function  $f(z) = \dfrac{ze^{z(\alpha+1)}}{1-e^{2z}}.$ Then $f$ has a removable singularity at $0$ and simple poles at $k\pi\mathbb{i}$ where $k \in \mathbb{Z} - \{0\}$.
Choose $R > 0$ and $S > 0$ sufficiently large and consider the contour $\gamma = \gamma_1 + \gamma_2 + \gamma_3 + \gamma_4$ below.

Let $\beta = \alpha + 1.$
We have
$$\int_{\gamma_1}f(z)dz = \int_{-R}^S\dfrac{te^{t\beta}}{1-e^{2t}}dt.$$
$$|\int_{\gamma_2}f(z)dz| \leq  \sup_{0 \leq t \leq 3\pi/2} |\dfrac{(S+i t)e^{(S+i t)\beta}}{1-e^{2(S+i t)}}| \times \text{length}(\gamma_2) \leq \frac{3\pi}{2} \times \dfrac{(S+3\pi/2)e^{S\beta}}{e^{2S}-1} \to 0 \text{ as } S \to \infty$$ as $\beta < 2$.
Similarly
$$|\int_{\gamma_4}f(z)dz| \leq  \sup_{0 \leq t \leq 3\pi/2} |\dfrac{(-R+i t)e^{(-R+i t)\beta}}{1-e^{2(-R+i t)}}| \times \text{length}(\gamma_4) \leq \frac{3\pi}{2} \times \dfrac{(R+3\pi/2)e^{-R\beta}}{1-e^{-2R}} \to 0 \text{ as } R \to \infty$$ since $\beta > 0.$
$$
\begin{align}
-\int_{\gamma_3}f(z)dz &= \int_{-R}^S\dfrac{(t+i\frac{3\pi}{2})e^{\beta(t+i \frac{3\pi}{2})}}{1-e^{2(t+i \frac{3\pi}{2})}}dt\\
&= e^{i \frac{3\pi\beta}{2} }\left( \int_{-S}^R \dfrac{t e^{t\beta}}{1+e^{2t}}dt + \frac{3 \pi i}{2}\int_{-R}^{S} \frac{e^{t\beta}}{1+e^{2t}}dt \right) .
\end{align}
$$
Upon the substitution $t = \log x/2$ we have
$$
\int_{-R}^{S} \frac{e^{t\beta}}{1+e^{2t}}dt = \frac{1}{2}\int_{e^{-2R}}^{e^{2S}} \frac{x^{\beta/2 - 1}}{1+x}dx.
$$
Letting $R,S \to \infty$ we have
$$ 
 \int_{-\infty}^{\infty}\frac{e^{t\beta}}{1+e^{2t}}dt =\frac{1}{2}\int_{0}^{\infty}
\frac{x^{\beta/2 - 1}}{1+x}dx = \frac{\pi}{2}\operatorname{cosec}(\frac{\pi\beta}{2}),\label{e:1} \tag{*}
$$
where have used the well known integral identity $\int_{0}^{\infty} \frac{x^{a-1}}{1+x}dx = \pi \operatorname{cosec}{\pi a}$ for $0 < a < 1$, note that $0 < \beta/2 < 1$.
Differentiating both sides of $\eqref{e:1}$ with respect to $\beta$ we get
$$
 \int_{-\infty}^{\infty}\frac{te^{t\beta}}{1+e^{2t}}dt = -\frac{\pi^2}{4}\operatorname{cosec}(\frac{\pi\beta}{2})\cot(\frac{\pi\beta}{2}). \label{e:2} \tag{+}
$$
($\eqref{e:2}$ can also be verified using contour integration)
So as $R,S \to \infty$ we have
$$
-\int_{\gamma_3} f(z) dz \to  e^{i \frac{3\pi\beta}{2} } \left(  -\frac{\pi^2}{4}\operatorname{cosec}(\frac{\pi\beta}{2})\cot(\frac{\pi\beta}{2}) + \frac{3\pi^2 i}{4}\operatorname{cosec}(\frac{\pi\beta}{2})\right).
$$
From the residue theorem we also have for all $R,S > 0$
$$
\int_{\gamma}f(z)dz = 2\pi i \times \frac{ \pi i e^{\pi i \beta} }{-2} = \pi^2 e^{i \pi \beta}.
$$
This shows $$I = \lim_{\substack{R \to \infty \\ S \to \infty}} \int_{-R}^{S} \dfrac{te^{\beta t}}{1-e^{2t}}dt$$ exists and we have 
$$I -e^{i \frac{3\pi\beta}{2} } \left(  -\frac{\pi^2}{4}\operatorname{cosec}(\frac{\pi\beta}{2})\cot(\frac{\pi\beta}{2}) + \frac{3\pi^2 i}{4}\operatorname{cosec}(\frac{\pi\beta}{2})\right) = \pi^2 e^{i \pi \beta}.$$
Comparing reals sides of LHS and RHS above we get
$$
I  + \frac{\pi^2}{4}\cos(\frac{3\pi\beta}{2})
\operatorname{cosec}(\frac{\pi\beta}{2})\cot(\frac{\pi\beta}{2})+\frac{3\pi^2}{4}\sin(\frac{3\pi\beta}{2})\operatorname{cosec}(\frac{\pi\beta}{2}) = \pi^2 \cos(\pi \beta),
$$
or,
$$I = \pi^2\cos(\pi\beta) -  \frac{\pi^2}{4}\cos(\frac{3\pi\beta}{2})
\operatorname{cosec}(\frac{\pi\beta}{2})\cot(\frac{\pi\beta}{2})-\frac{3\pi^2}{4}\sin(\frac{3\pi\beta}{2})\operatorname{cosec}(\frac{\pi\beta}{2}),
$$
which would probably simplify further.
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{\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}$
$\ds{\mathcal{C}}$ is a key-hole contour which "takes care" of the $\ds{z^{\alpha}}$ principal branch. Namely,
\begin{align}
0 & = \int_{\mathcal{C}}{1 - z^{\alpha} \over 1 - z^{2}}\,\dd z
\\[5mm] & =
\int_{-\infty}^{0}{\pars{-x}^{\alpha}\expo{\ic\pi\alpha} - 1 \over
\pars{x + 1 + \ic 0^{+}}\pars{x - 1}}\,\dd x +
\int_{0}^{-\infty}{\pars{-x}^{\alpha}\expo{-\ic\pi\alpha} - 1 \over
\pars{x + 1 - \ic 0^{+}}\pars{x - 1}}\,\dd x
\\[5mm] & =
\int_{0}^{\infty}{x^{\alpha}\expo{\ic\pi\alpha} - 1 \over
\pars{x - 1 - \ic 0^{+}}\pars{x + 1}}\,\dd x -
\int_{0}^{\infty}{x^{\alpha}\expo{-\ic\pi\alpha} - 1 \over
\pars{x - 1 + \ic 0^{+}}\pars{x + 1}}\,\dd x
\\[5mm] & =
\braces{\mrm{P.V.}\int_{0}^{\infty}{x^{\alpha}\expo{\ic\pi\alpha} - 1 \over
x^{2} - 1}\,\dd x +
\int_{0}^{\infty}{x^{\alpha}\expo{\ic\pi\alpha} - 1 \over
x + 1}\bracks{\ic\pi\,\delta\pars{x - 1}}\,\dd x} 
\\[2mm] &\, -
\braces{\!\!\mrm{P.V.}\!\int_{0}^{\infty}\!
{x^{\alpha}\expo{-\ic\pi\alpha} - 1 \over x^{2} - 1}\,\dd x\! +
\int_{0}^{\infty}\!{x^{\alpha}\expo{-\ic\pi\alpha} - 1 \over
x + 1}\bracks{-\ic\pi\,\delta\pars{x - 1}}\,\dd x\!\!}
\\[5mm] & =
2\ic\sin\pars{\pi\alpha}\
\mrm{P.V.}\int_{0}^{\infty}{x^{\alpha} \over x^{2} - 1}\,\dd x +
\ic\pi\cos\pars{\pi\alpha} - \pi\ic
\\[5mm] \implies &
\mrm{P.V.}\int_{0}^{\infty}{x^{\alpha} \over 1 - x^{2}}\,\dd x =
-\,{1 \over 2}\,\pi\,{1 - \cos\pars{\pi\alpha} \over
\sin\pars{\pi\alpha}} = -\,{1 \over 2}\,\pi\,\tan\pars{\pi\alpha \over 2}
\end{align}
Derive both member respect of $\ds{\alpha}$:
\begin{align}
&\mbox{}
\\
\bbx{\int_{0}^{\infty}{x^{\alpha}\ln\pars{x} \over 1 - x^{2}}\,\dd x =
-\,{\pi^{2} \over 4^{\phantom{2}}}\sec^{2}\pars{\pi\alpha \over 2}}
\\ &
\end{align}
