I want to integrate: $$\int_{-\infty}^\infty e^{x/2}\operatorname{sech}(x)\,dx.$$
I've trying to test some of my integration skills by attempting some integrals that are standard with residues, but for this one, I must be making a very silly mistake because after checking things with a calculator it doesn't align with what should be right.
I started with integration by parts letting: $u=e^{x/2} => du=\frac{1}{2}e^{x/2}\,dx$ and $dv=\operatorname{sech}(x)\,dx => v=2\arctan(e^x)$ or $-2\arctan(e^{-x})$
I split the integral of $\operatorname{sech}(x)$ into two integrals so it would converge for the limits at infinity (this seemed to work for other integrals I did). After plugging everything:$$-2e^{x/2}\arctan(e^{-x})|_{-\infty}^{\infty}-\int_0^\infty e^{x/2}v\,dx =$$ $$-\int_{-\infty}^0 e^{x/2}\arctan(e^x)\,dx+\int_0^{\infty}e^{x/2}\arctan(e^{-x})\,dx. $$
This, however, is not correct, and I've been staring at it for too long. It would be much appreciated if some help could be given!
We can proceed by folding the integral, expressing the denominator of the integrand as a geometric series, interchanging the order of integration and summation, and converting the resulting series into a simple integral.
So, here we go ...
$$\begin{align} \int_{-\infty}^\infty e^{x/2}\text{sech}(x)\,dx&=2\int_0^\infty \frac{e^{x/2}+e^{-x/2}}{e^x+e^{-x}}\,dx\\\\ &=2\int_0^\infty \frac{e^{-x/2}+e^{-3x/2}}{1+e^{-2x}}\,dx\\\\ &=2\sum_{n=0}^\infty (-1)^n\int_0^\infty \left (e^{-(2n+1/2)x}+e^{-(2n+3/2)x}\right)\,dx\\\\ &=2\sum_{n=0}^\infty (-1)^n\left(\frac{1}{2n+1/2}+\frac{1}{2n+3/2}\right)\\\\ &=4\sum_{n=0}^\infty (-1)^n\left(\frac{1}{4n+1}+\frac{1}{4n+3}\right)\\\\ &=4\sum_{n=0}^\infty (-1)^n \left(\int_0^1 x^{4n}\,dx+\int_0^1 x^{4n+2}\,dx\right)\\\\ &=4\int_0^1 \left(\frac{1+x^2}{1+x^4}\right)\,dx\\\\ &=\sqrt2 \pi \end{align}$$
An alternative approach is to begin with the substitution $x\mapsto\log(x^2)$. Then, we have
$$\begin{align} \int_{-\infty}^\infty e^{x/2}\text{sech}(x)\,dx&=2\int_0^\infty \frac{e^{x/2}+e^{-x/2}}{e^x+e^{-x}}\,dx\\\\ &=4\int_1^\infty \frac{x^2+1}{x^4+1}\,dx\\\\ &\overbrace{=}^{x\mapsto 1/x}4\int_0^1 \left(\frac{1+x^2}{1+x^4}\right)\,dx\\\\ &=\sqrt2 \pi \end{align}$$