TITLE: Integration of $\dfrac{x}{\sinh x}~dx$ from $-\infty$ to $\infty$
QUESTION [6 upvotes]: Problem from set on recidues:
Evaluate $$\int_0^\infty \frac{\log x}{(x-1) \sqrt{x}}~dx.$$
After the substitution $x = e^u$ and easy computations. The integral becomes $$\int_{-\infty}^\infty \frac{x}{\sinh x}~dx.$$

REPLY [6 votes]: This was trickier than I thought, 
but a method using complex analysis would be as follows:
As integration contour we choose a rectangle with vertices $\pm R,\pm R+\pi i $
Now let's define $I =\int_C\frac{z}{\sinh(z)}$ . We can write (the limit $R\rightarrow\infty$ is implicit) 
$$
I=\underbrace{I_1}_{\text{Real Line}}+\underbrace{I_2}_{\text{Real Line}+i\pi}+\underbrace{I_3+I_4}_{\text{Vertical pieces}}+\underbrace{I_5}_{\text{small circle avoiding }z=i\pi}=0
$$
by Cauchy's theorem.
It's now an easy task to show that (using $\sinh(x+i \pi)=-\sinh(x)$)
a) $I_1+I_2=2I_1-i\pi P\int_{-\infty}^{\infty}\frac{1}{\sinh(x)}$, where $P$ denotes Cauchy's principal part
b) The vertical pieces vanish
So our problem boils down to
$$
I_1=\frac{i\pi}{2} \underbrace{P\int_{-\infty}^{\infty}\frac{1}{\sinh(x)}dx}_{(*)}+\underbrace{\frac{i\pi}{2}\lim_{r\rightarrow0}\int_0^{\pi}\frac{r e^{i\phi}}{i\sinh(r e^{i\phi})}d\phi}_{I_5/2}
$$
Now $(*)=0$ essentially because $\frac{1}{\sinh(x)}$ is odd and we integrate over an even intervall.
Furthermore , using the fact that $\sinh(x)\approx x$ for small $x$ 
$$
I_1=\underbrace{\frac{\pi}{2}\int_0^{\pi}d\phi}_{I_5/2}=\frac{\pi^2}{2}
$$
And we are done
Appendix
I can't resist i have to do something really crazy (the purists may forgive me):
!Warning this part is by no means rigorous!
Let's assume that we can choose a large semicircle in the upper half plane as an integration contour (which is a quite delicate assumption because on the imaginary axis, and only there our integral is not convergent) then our integral is given by 
$$
I_1= 2\pi i\sum_{n=0}^{\infty} \text{Res}[I(z),z=i n \pi]
$$
and now he appears, one of my dearest friends from  Quantum Field Theory,
the heavily divergent sum of alternating natural numbers
$$
I_1=-2 \pi^2 \sum_{n=0}^{\infty}(-1)^n n
$$
Now what to do? It turns out that by an appropriate regularization procedure (Borel summation, $\zeta$-methods, ..., just to give you a few buzzwords) we can assign the value -1/4
to this sum and end up with
$$
I_1=\frac{\pi^2}{2}
$$
Which is surprisingly the correct result. 
I would be really interested if someone could explain  the correspondance between a divergent piece of width 0 in the integration contour and the  divergent sum of residues, which after a proper regularization, gives us nevertheless a correct and finite result. Or is this just coincidence (i have the feeling that it is NOT)