Keyhole contour for integral with pole on cut $$\textrm{p.v.}\int\limits_0^\infty \frac{\ln x \ dx}{x^4-16}$$
I have to solve this integral. So I got an idea I've seen several times, here it is: let's take a keyhole contour with cut on positive part of real line. And I gonna use $\ln^2 x$ instead of $ln x$, should help in the end.
Then I can compute integral along this contour by Cauchy residue theorem (I have 3 simple poles inside: -2, 2i, -2i). Then I think I can show that circles integrals vanish as their radii approaches $0$ and $\infty$, respectively.
The only thing I'm not sure about is the last, 4th pole z=2, lying on my cut. Does my method still work with it lying there? Thanks.
P.S. I'm also not sure what p.v. means in this case, I would appreciate if you enlight me about this a little bit.
 A: First, the integral $I=\int_0^\infty \frac{\log(x)}{x^4-16}\,dx$ diverges.  However, its Principal Value, $$\text{PV}\left(\int_0^\infty \frac{\log(x)}{x^4-16}\,dx\right)=\lim_{\varepsilon\to  0^+}\left(\int_0^{2-\varepsilon} \frac{\log(x)}{x^4-16}\,dx+\int_{2+\varepsilon}^\infty \frac{\log(x)}{x^4-16}\,dx\right)$$ converges.  We shall interpret $I$ in terms of the Principal Value integral.

We simplify the problem by enforcing the substitution $x\mapsto 2x$ and find that
$$\begin{align}
I&=\frac18 \text{PV}\left(\int_0^\infty \frac{\log(2x)}{x^4-1}\,dx\right)\\\\
&=\frac18 \text{PV}\left(\int_0^\infty \frac{\log(x)}{x^4-1}\,dx\right)-\frac{\pi\log(2)}{32}\\\\
\end{align}$$

Next, we let $f(z)=\frac{\log^2(z)}{z^4-1}$.  Then, we cut the plane along the non-negative real axis and integrate aound the classical keyhole contour with deformations around the pole at $z=1$.
Proceeding, we have for $\varepsilon\in (0,1)$ and $R>1$
$$\begin{align}
\oint_{C_{\varepsilon,R}} f(z)\,dz&=\int_0^{1-\varepsilon}\frac{\log^2(x)-(\log(x)+i2\pi)^2}{x^4-1}\,dx+\int_{1+\varepsilon}^R \frac{\log^2(x)-(\log(x)+i2\pi)^2}{x^4-1}\,dx\\\\
&+\underbrace{\int_\pi^0 \frac{\log^2(1+\varepsilon e^{i\phi})}{(1+\varepsilon e^{i\phi})^4-1}\,i\varepsilon e^{i\phi}\,d\phi}_{\to 0\,\,\text{as}\,\varepsilon\to 0^+}+\underbrace{\int_{2\pi}^\pi \frac{\log^2(1+\varepsilon e^{i\phi})}{(1+\varepsilon e^{i\phi})^4-1}\,i\varepsilon e^{i\phi}\,d\phi}_{\to i\pi^3\,\,\text{as}\,\,\varepsilon\to 0^+}\\\\
&+\underbrace{\int_0^{2\pi}\frac{\log^2(Re^{i\phi})}{(Re^{i\phi})^4-1}\,iRe^{i\phi}\,d\phi}_{\to 0\,\,\text{as}\,\,R\to \infty}\\\\
&=2\pi  i \left(\text{Res}\left(f(z), z=- 1\right)+\text{Res}\left(f(z), z=i\right)+\text{Res}\left(f(z), z=- i\right)\right)
\end{align}$$
where we used the residue theorem to arrive at the last line.

Noting that
$$\begin{align}
2\pi  i \left(\text{Res}\left(f(z), z=- 1\right)+\text{Res}\left(f(z), z=i\right)+\text{Res}\left(f(z), z=- i\right)\right)&=i \pi^3/2-\pi^3
\end{align}$$
and letting $\varepsilon\to 0^+$ and $R\to \infty$ reveals
$$\begin{align}
-i4\pi \text{PV}\int_0^\infty \frac{\log(x)}{x^4-1}\,dx+4\pi^2 \underbrace{\text{PV}\int_0^\infty \frac{1}{x^4-1}\,dx}_{=-\pi/4}+i\pi^3=i \pi^3/2-\pi^3
\end{align}$$

Finally, putting it all together, we find that
$$I=\frac{\pi^2}{64}-\frac{\pi\log(2)}{32}$$
A: This is not a solution to the OP in a rigorous sense but an extended comment.
Here is a peculiar way to solve a typical principal value problem.
Consider this integral which, because of the singularity of the integrand at $x=1$, is understood as the Cauchy principal value
$$i=\text{p.v.}\int_0^{\infty } \frac{x^{a-1}}{1-x^n} \, dx\tag{1}$$
Now consider the following integral where the integrand differs by a factor $\log(x)$
$$i_1=\int_0^{\infty } \frac{x^{a-1} }{1-x^n}\log (x) \, dx\tag{2}$$
Here the point $x=1$ is not a singularity of the integrand any more. Hence no principal value needs to be taken.
Notice that the factor $\log(x)$ can be generated by taking the derivative of $i$ with respect to the parameter $a$, i.e. we have
$$i_1=\frac{\partial}{\partial a} i\tag{3}$$
Now the integral $i_1$ is evaluated in Gradshteyn/Ryshik 4.251.2 to
$$i_1 =-\frac{\pi ^2 \csc ^2\left(\frac{\pi  a}{n}\right)}{n^2}\tag{4}$$
And here comes the trick: we invert the relation $(3)$, i.e. we cancel the factor $\log(x)$ in the integrand by performing the indefinite integral
$$\int x^{a-1} \, da=\frac{x^{a-1}}{\log (x)}\tag{5}$$
Doing the same operation with the result $i_1$ in $(4)$ we get
$$\int \left(-\frac{\pi ^2 \csc ^2\left(\frac{\pi  a}{n}\right)}{n^2}\right) \, da=\frac{\pi  \cot \left(\frac{\pi  a}{n}\right)}{n}\tag{6}$$
This is indeed the result of the integral $i$.
