How to calculate $\int_{-\infty}^{\infty}\frac{x^2}{\cosh(x)}\mathrm{d}x$ I know the poles are $z=i\pi/2+i n\pi$ and therefor I got an rectangular contour for the integration which wasn't so useful. I also know with change of variables I can get to $\int_{0}^{\infty}\frac{\log(x)^2}{1+x^2}\mathrm{d}x$ but I don't want to use this I want to evaluate the original integral.
 A: Consider the integral
$$\oint_C dz \frac{z^2}{\cosh{z}} $$
where $C$ is the rectangle having vertices $-R$, $R$, $R+ i \pi$, $-R + i \pi$. This contour integral is equal to
$$\int_{-R}^R dx \frac{x^2}{\cosh{x}} + i \int_0^{\pi} dy \frac{(R+i y)^2}{\cosh{(R+i y)}} \\ + \int_R^{-R} dx \frac{(x+i \pi)^2}{\cosh{(x+i \pi)}} + i \int_{\pi}^0 dy \frac{(-R+i y)^2}{\cosh{(-R+i y)}} $$
As $R \to \infty$, the second and fourth integrals vanish.  (Why?)  By the residue theorem, the contour integral is equal to $i 2 \pi$ times the residue at the pole $z=i \pi/2$.  Thus, we have in the limit
$$2 \int_{-\infty}^{\infty} dx \frac{x^2}{\cosh{x}} + i 2 \pi \int_{-\infty}^{\infty} dx \frac{x}{\cosh{x}} - \pi^2 \int_{-\infty}^{\infty} \frac{dx}{\cosh{x}} = i 2 \pi \frac{(i \pi/2)^2}{\sinh{(i \pi/2)}}$$
The second integral is zero.  The third integral may be done similarly, i.e., by considering
$$\oint_C \frac{dz}{\cosh{z}} = 2 \int_{-\infty}^{\infty} \frac{dx}{\cosh{x}} = i 2 \pi \frac{1}{\sinh{(i \pi/2)}} = 2 \pi$$
Thus,
$$2 \int_{-\infty}^{\infty} dx \frac{x^2}{\cosh{x}} - \pi^3 = 2 \pi \left (-\frac{\pi^2}{4} \right ) $$
or

$$\int_{-\infty}^{\infty} dx \frac{x^2}{\cosh{x}} = \frac{\pi^3}{4} $$

