I'd like to compute: $$ I_n = \int_{-\infty}^{+\infty}\mathrm{d}x\frac{x^{2n}}{\cosh^2 x}. $$ We have, quite easily: $$ I_0 = \int_{-\infty}^{+\infty}\mathrm{d}x\frac{1}{\cosh^2 x}=\left[\tanh x\right]_{-\infty}^{+\infty}=2. $$ So to begin with, I gave a try at $$ I_1 = \int_{-\infty}^{+\infty}\mathrm{d}x\frac{x^{2}}{\cosh^2 x}. $$ My idea was to use the following contour $\Gamma_{\varepsilon, M}$ to integrate on in the complex plane: the rectangle with vertices $M$, $M+i\frac{\pi}{2}$, $-M+i\frac{\pi}{2}$, $-M$, and an indent of radius $\varepsilon$ at $i\frac{\pi}{2}$, where $\cosh z=0$. Then by Residues Theorem: $$ \oint_{\Gamma_{\varepsilon, M}} \mathrm{d}z\frac{z^{2}}{\cosh^2 z} = 0. $$
Problem is, when I make the calculations the integrand is still singular $O(\frac{1}{\varepsilon})$ on my semicircle. More explicitly: $$ \int_{0}^{-\pi} \mathrm{d}\theta i\varepsilon e^{i\theta}\frac{(i\frac{\pi}{2}+\varepsilon e^{i\theta})^{2}}{\cosh^2 (i\frac{\pi}{2}+\varepsilon e^{i\theta})} = \int_{0}^{-\pi} \mathrm{d}\theta i\varepsilon e^{i\theta} \frac{-\frac{\pi^2}{4} + O(\varepsilon)}{\varepsilon^2e^{2i\theta}+O(\varepsilon^3)}. $$ To avoid this problem I tried: $$ \oint_{\Gamma_{\varepsilon, M}} \mathrm{d}z\frac{(z-i\frac{\pi}{2})^{2}}{\cosh^2 z}=0. $$
But then I only get: $$ \int \mathrm{d}x\frac{(x-i\frac{\pi}{2})^{2}}{\cosh^2x}-\int \mathrm{d}x\frac{x^{2}}{\cosh^2(x-i\frac{\pi}{2})}=0 $$ $$ \int \mathrm{d}x\left(\frac{x^2}{\cosh^2x}+\frac{x^2}{\sinh^2x}\right) = \frac{\pi^2}{2} $$
since $\cosh(x+i\frac{\pi}{2}) = i\sinh x$.