Evaluating $\int_{-\infty}^{\infty}\operatorname{sech}(x)\tanh(x)\cos(x+x_0)\,\mathrm dx$ I am trying to compute by hand this integral:
$$ \int_{-\infty}^{\infty} \operatorname{sech}(x) \tanh(x)\cos(x+x_0) \,\mathrm dx 
=\int_{-\infty}^{\infty} \frac{\cos (x+x_0)}{\cosh x} \,\mathrm dx \\
=\int_{-\infty}^{\infty} \frac{e^{ix_0}\ e^{ix}+e^{-ix_0}\ e^{-ix}} {e^{x}+e^{-x}} \,\mathrm dx =\int_{-\infty}^{\infty} \frac{e^{ix_0}\ e^{(1+i)x}+e^{-ix_0}\ e^{(1-i)x}} {e^{2x}+1} \,\mathrm dx $$ 
Then we subsitute $t=\ e^{2x} ,\mathrm dx=\frac{1}{2t}\,\mathrm dt$ so we get:
$$=\frac{1}{2}\int_{0}^{\infty} \frac{e^{ix_0}\ t^{1/2(1+i)}+e^{-ix_0}\ t^{1/2(1-i)}}{t+1}\ x^{-1} \,\mathrm dt \\
=\frac{1}{2}\int_{0}^{\infty}\frac{e^{ix_0}\ t^{1/2(-1+i)}}{t+1}\,\mathrm dt\,+ \frac{1}{2}\int_{0}^{\infty}\frac{e^{-ix_0}\ t^{1/2(-1-i)}}{t+1}\,\mathrm dt  $$
It's true that: $\int_{0}^{\infty}\frac{x^n}{x+1}\,\mathrm dx= \frac{-\pi}{\sin(n\pi)}$, so our integral is:
$$=\frac{1}{2}\left[e^{ix_0}\ \frac{-\pi}{\sin (-\frac{\pi}{2}\, +i\ \frac{\pi}{2})}\,+e^{-ix_0}\ \frac{-\pi}{\sin (-\frac{\pi}{2}\, -i\ \frac{\pi}{2})}\right]\\
=\frac{\pi}{2\cosh(\frac{\pi}{2})}(e^{ix_0}+e^{-ix_0})\\
=\pi \operatorname{sech}(\pi /2)\cos x_0$$
However, in bibliography I find it equal to
$$-\pi \operatorname{sech}(\pi /2)\sin(x_0).$$
What am I doing wrong?.
Thanks in advance.
 A: $\newcommand{\sech}{\operatorname{sech}}$Use integration by parts with $u=\cos(x+x_0)$ and $v=-\sech x$ to get
$$\int\limits_{-\infty}^{+\infty}\sech x\tanh x\cos(x+x_0)\,\mathrm dx=-\int\limits_{-\infty}^{+\infty}\frac {\sin(x+x_0)}{\cosh x}\,\mathrm dx$$
Next, use the expansion of $\sin(x+x_0)$ to rewrite the integral as
$$\int\limits_{-\infty}^{+\infty}\frac {\sin x\cos x_0+\sin x_0\cos x}{\cosh x}\,\mathrm dx=\cos x_0\int\limits_{-\infty}^{+\infty}\frac {\sin x}{\cosh x}\,\mathrm dx+\sin x_0\int\limits_{-\infty}^{+\infty}\frac {\cos x}{\cosh x}\,\mathrm dx$$
The first integral contains an odd function since $\cosh(-x)=\cosh x$ and $\sin(-x)=-\sin x$. Hence, the first integral vanishes leaving behind only the second integral. Using the definition of $\cosh x$, rewrite the integrand as an infinite sequence and term-wise integrate
$$\begin{align*}\int\limits_{-\infty}^{+\infty}\frac {\cos x}{\cosh x}\,\mathrm dx & =4\sum\limits_{n=0}^{+\infty}(-1)^n\int\limits_0^{+\infty} e^{-x(2n+1)}\cos x\,\mathrm dx\\ & =4\sum\limits_{n=0}^{+\infty}(-1)^n\frac {2n+1}{1+(2n+1)^2}\\ & =\pi\sech\left(\frac {\pi}2\right)\end{align*}$$
Thus
$$\int\limits_{-\infty}^{+\infty}\sech x\tanh x\cos(x+x_0)\,\mathrm dx=-\pi\sin x_0\sech\left(\frac {\pi}2\right)$$

There exists an elegant proof of the result
$$\sum\limits_{n=0}^{+\infty}(-1)^n\frac {2n+1}{1+(2n+1)^2}=\frac {\pi}4\sech\left(\frac {\pi}2\right)$$
That I found a while back - I'll try to see if I can figure out where I found it from. Use partial fraction decomposition to expand the sum into two separate components and employ the infamous identity
$$\sum\limits_{n=-\infty}^{+\infty}\frac {(-1)^n}{a+n}=\pi\csc\pi a$$
To get
$$\begin{align*}\sum\limits_{n=0}^{+\infty}(-1)^n\frac {2n+1}{1+(2n+1)^2} & =\frac 12\sum\limits_{n=0}^{+\infty}(-1)^n\left(\frac 1{2n+1+i}-\frac 1{-2n-1+i}\right)\\ & =\frac 14\sum\limits_{n=0}^{+\infty}\frac {(-1)^n}{n+(1+i)/2}+\frac 14\sum\limits_{n=-\infty}^{-1}\frac {(-1)^n}{n+(1+i)/2}\\ & =\frac 14\sum\limits_{n=-\infty}^{+\infty}\frac {(-1)^n}{n+(1+i)/2}\\ & =\frac {\pi}4\csc\left(\frac {\pi(1+i)}2\right)\\ & =\frac {\pi}4\sech\left(\frac {\pi}2\right)\end{align*}$$
