How to evaluate $ \int_0^\infty \frac{\log x}{(x^2+a^2)^2} dx $ 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)$.
 A: 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.
A: I thought that it might be instructive to add to the answer posted by @RonGordon.  We note that the integral of interest $I_1(a^2)$ can be written
$$I_1(a^2)=\int_0^\infty \frac{\log^2 x}{(x^2+a^2)^2}\,dx=-\frac{dI_2(a^2)}{d(a^2)}$$
where 
$$I_2(a^2)=\int_0^\infty\frac{\log^2x}{x^2+a^2}\,dx$$
Now, we can evaluate the integral $J(a^2)$
$$J(a^2)=\oint_C \frac{\log^2z}{z^2+a^2}\,dz$$
where $C$ is the key-hole contour defined in the aforementioned post.   There, we have
$$\begin{align}
J(a^2)&=-4\pi i\,I_2(a^2)+4\pi^2\int_0^\infty \frac{1}{x^2+a^2}\,dx \\\\
&=-4\pi i\, I_2(a^2)+\frac{2\pi^3}{a}\\\\
&=2\pi i \left(\text{Res}\left(\frac{\log^2 z}{z^2+a^2},ia\right)+\left(\text{Res}\left(\frac{\log^2 z}{z^2+a^2},-ia\right)\right)\right)
\end{align}$$
Finally, after calculating the residues, and simplifying, we obtain the integral $I_2(a^2)$ whereupon differentiating with respect to $a^2$ recovers the integral of interest $I_1(a^2)$.  And we are done.
A: Let $x=at$. We then have
\begin{align}
I & = \int_0^{\infty} \dfrac{\log(x)}{(x^2+a^2)^2}dx = \dfrac1{a^3}\cdot\int_0^{\infty} \dfrac{\log(at)}{(t^2+1)^2}dt = \dfrac1{a^3}\left(\int_0^{\infty} \dfrac{\log(a)}{(t^2+1)^2}dt + \int_0^{\infty} \dfrac{\log(t)}{(t^2+1)^2}dt\right)\\
& = \dfrac{J+K}{a^3}
\end{align}
where $J=\displaystyle\int_0^{\infty} \dfrac{\log(a)}{(t^2+1)^2}dt$ and $K = \displaystyle\int_0^{\infty} \dfrac{\log(t)}{(t^2+1)^2}dt$.
$$J = \int_0^{\pi/2}\dfrac{\log(a)}{(\tan^2(y)+1)^2}\sec^2(y)dy = \log(a)\int_0^{\pi/2}\cos^2(y)dy = \dfrac{\pi\log(a)}4$$
\begin{align}
K & = \displaystyle\int_0^1 \dfrac{\log(t)}{(t^2+1)^2}dt + \displaystyle\int_1^{\infty} \dfrac{\log(t)}{(t^2+1)^2}dt\\
& = \displaystyle\int_0^1 \dfrac{\log(t)}{(t^2+1)^2}dt + \displaystyle\int_1^0 \dfrac{\log(1/t)}{(1/t^2+1)^2}\dfrac{-dt}{t^2}\\
& = \int_0^1 \dfrac{(1-t^2)}{(1+t^2)^2}\cdot\log(t)dt\\
& = \sum_{k=0}^{\infty}(-1)^k (2k+1) \int_0^1 t^{2k}\log(t)dt\\
& = \sum_{k=0}^{\infty}(-1)^{k+1} \dfrac1{2k+1}\\
& = -1 + \dfrac13 - \dfrac15 + \dfrac17 \mp \cdots = -\dfrac{\pi}4
\end{align}
Hence, the integral is $$\dfrac{\pi(\log(a)-1)}{4a^3}$$
A: Real Method
We first evaluate the integral
$$
J=\int_0^{\infty} \frac{\ln x}{x^2+a^2} d x
$$
Putting $x=\tan \theta$ yields
$$
\begin{aligned}
J& =\int_0^{\infty} \frac{\ln x}{x^2+a^2} d x \\
& =\int_0^{\frac{\pi}{2}} \frac{\ln (a \tan \theta)}{a^2 \sec ^2 \theta} \cdot a \sec ^2 \theta d \theta \\
& =\frac{1}{a} \int_0^{\frac{\pi}{2}} \ln (a \tan \theta)  d \theta \\
& =\frac{1}{a} \int_0^{\frac{\pi}{2}} \ln a d \theta+  \underbrace{\int_0^{\frac{\pi}{2}} \ln (\tan \theta) d \theta }_{=0}  \\
& =\frac{\pi}{2} \frac{\ln a}{a}
\end{aligned}
$$
Differentiating both sides w.r.t. $a$ yields
$$
\begin{aligned}
& -2 a \int_0^{\infty} \frac{\ln x}{\left(x^2+a^2\right)^2} d x=\frac{\pi}{2} \frac{1-\ln a}{a^2} \\
\Rightarrow & \int_0^{\infty} \frac{\ln x}{\left(x^2+a^2\right)^2}=\frac{\pi(\ln a-1)}{4 a^3}
\end{aligned}
$$
