Evaluate $$ \int_0^\infty \frac{\log x}{(x^2+a^2)^2} dx $$ $$(a>0) $$
How can I use contour appropriately?
What is the meaning of this integral?
(additionally posted)
I tried to solve this problem.
First, I take a branch $$ \Omega=\mathbb C - \{z|\text{Re}(z)=0\; \text{and} \; \text{Im}(z)\le0\} $$
Then ${\log_\Omega z}=\log r +i\theta (-\frac{\pi}{2}\lt\theta\lt\frac{3\pi}{2})$
Now, $\frac{\log z}{(z^2+a^2)^2}$ is holomorphic in $\Omega - \{ai\}$ with double poles at $ai$.
Now I'll take the contour which forms an indented semicircle.
For any $0\lt\epsilon\lt{a}$, where $\max (1,a)\lt R$, $\Gamma_{R,\epsilon}\subseteq\Omega - \{ai\}$ and in $\Omega$, $i=e^{i\pi/2}$.
Now using the residue formula, $$2\pi{i}\operatorname*{Res}_{z=ai}\frac{\log_\Omega{z}}{(z^2+a^2)^2}=2\pi{i}\operatorname*{lim}_{z\to ai}\frac{d}{dz}(z-ai)^2\frac{\log_\Omega{z}}{(z^2+a^2)^2}=\frac{\pi}{2a^3}(\log_\Omega{ai}-1)$$
Now, the last part, take $i=e^{i\pi/2}$, then is equal to $\frac{\pi}{2a^3}(\log{a}-1+i\pi/2)$
So, I can split integrals by four parts,
$$\int_{\epsilon}^R dz + \int_{\Gamma_R} dz + \int_{-R}^{-\epsilon} dz + \int_{\Gamma_\epsilon} dz$$
First, evaluate the second part,
$$\left|\int_{\Gamma_R} dz\right|\le\int_0^{\pi}\left|\frac{\log_\Omega{Re^{i\theta}}}{(R^2e^{2i\theta}+a^2)^2}iRe^{i\theta}\right|d\theta$$
Note that
$$\left|\log_\Omega{Re^{i\theta}}\right|=\left|\log R+i\theta\right|\le\left|\log R\right|+|\theta|$$ $$\left|R^2e^{2i\theta}+a^2\right|\ge R^2-a^2\quad (R\gt a)$$
Then, 2nd part $\le\frac{R(\pi R+\frac{\pi^2}{2})}{(R^2+a^2)^2}\to 0\; \text{as} \; R \to \infty\quad \left|\log R\right|\lt R\;\text{where}\;(R\gt 1)$
So, 4th part similarly, goes to $\;0$.
Then 3rd part, substitute for $\;t=-z$,
$$\int_\epsilon^{R}\frac{\log t}{(t^2+a^2)^2}dt + i\pi\int_\epsilon^{R}\frac{dt}{(t^2+a^2)^2}$$
And $\;i\pi\lim\limits_{{\epsilon \to 0},\;{R\to\infty}}\int_\epsilon^{R}\frac{dt}{(t^2+a^2)^2}=\frac{\pi}{4a^3}$
With tedious calculations, I got $\frac{\pi}{4a^3}(\log a -1)$.
One thing you can do when confronted with integrals of the form
$$\int_0^{\infty} dx \, f(x) \log{x} $$
is to consider a contour integral of the form
$$\oint_C dz \, f(z) \, \log^2{z} $$
where $C$ is a keyhole contour about the positive real axis, as pictured below.
To evaluate the contour integral, we parametrize about each piece of the contour. There are four such pieces: a large arc of radius $R$, a small arc of radius $\epsilon$, and lines above and below the positive real axis.
This contour allows us to derive the integral of interest by exploiting the multivalued behavior of the log at a branch point. In this case, we define the argument of the complex numbers above the positive real axis to be zero and below to be $2 \pi$. Thus, above the real axis $z=x$ while below $z=x e^{i 2 \pi}$. This difference is crucial when taking logs.
I will let the reader perform the analysis as the outer radius $R \to \infty$ and inner radius $\epsilon \to 0$; the contour integral is then equal to
$$\int_0^{\infty} dx \, f(x) \log^2{x} - \int_0^{\infty} dx \, f(x) (\log{x}+i 2 \pi)^2 = -i 4 \pi \int_0^{\infty} dx \, f(x) \log{x} + 4 \pi^2 \int_0^{\infty} dx \, f(x) $$
By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $z_k$ of $f$ in the complex plane outside of the origin. Thus,
$$\int_0^{\infty} dx \, f(x) \log{x} = -i \pi \int_0^{\infty} dx \, f(x) - \frac12 \sum_k \operatorname*{Res}_{z=z_k} [f(z) \log^2{z}]$$
In the OP's case,
$$f(z) = \frac1{(z^2+a^2)^2}$$
so the poles are of order two and the residues must be computed accordingly. The OP should be able to derive
$$ \operatorname*{Res}_{z=\pm i a} \frac{\log^2{z}}{(z^2+a^2)^2} = \left[\frac{d}{dz} \frac{\log^2{z}}{(z\pm i a)^2} \right ]_{z=\pm i a} $$
Note also that the poles must have their arguments between $[0,2 \pi]$ for the residue calculation to come out correctly. In this case, we may say that the poles are at $z_{\pm}=\pm i a$, but it is important to note that $z_+ = a e^{i \pi/2}$ and $z_-=a e^{i 3 \pi/2}$.
Further, it should not escape notice that the final result is in terms of an integral over the function $f$ without the log term. You should be able to see that the integral may be evaluated in exactly the same way as the original integral by introducing a log and integrating over the keyhole contour $C$. The result is
$$\int_0^{\infty} dx \, f(x) = -\sum_k \operatorname*{Res}_{z=z_k} [f(z) \log{z}]$$
At this point the OP has everything needed to carry out the computation.