Evaluating an improper integral using complex analysis I am trying to evaluate the improper integral $I:=\int_{-\infty}^\infty f(x)dx$, where
$$
f(z) := \frac{\exp((1+i)z)}{(1+\exp z)^2}.
$$
I tried to do this by using complex integration. Let $L,L^\prime>0$ be real numbers, and $C_1, C_2, C_3, C_4$ be the line segments that go from $-L^\prime$ to $L$, from $L$ to $L+2\pi i$, from $L + 2\pi i$ to $-L^\prime+2\pi i$ and from $-L^\prime+2\pi i$ to $-L^\prime$, respectively.  Let $C = C_1 + C_2 + C_3 + C_4$.
Here we have (for sufficiently large $L$ and $L^\prime$)
$$
\int_{C_2}f(z) dz \le \int_0^{2\pi}\left|\frac{\exp((1+i)(L+iy))}{(\exp(L+iy)+1)}i\right| dy \le \int\frac{1}{(1-e^{-L})(e^L - 1)}dy\rightarrow0\quad(L\rightarrow\infty),
$$
$$
\int_{C_4}f(z)dz\le\int_0^{2\pi}\left|\frac{\exp((1+i)(-L^\prime+iy))}{(\exp(-L^\prime + iy) + 1))^2}(-i)\right|dy\le\int\frac{e^{-L^\prime}}{(1-e^{-L})^2}dy\rightarrow 0\quad(L^\prime\rightarrow\infty),
$$
and
$$
\int_{C_3}f(z)dz = e^{-2\pi}\int_{C_1}f(z)dz.
$$
Thus $$I = \lim_{L,L^\prime\rightarrow\infty}\frac{1}{ (1 + e^{-2\pi})}\oint_Cf(z)dz.$$
Within the perimeter $C$ of the rectangle, 
$f$ has only one pole: $z = \pi i$.  Around this point, $f$ has the expansion
$$
f(z) = \frac{O(1)}{(-(z-\pi i)(1 + O(z-\pi i)))^2} =\frac{O(1)(1+O(z-\pi i))^2}{(z-\pi i)^2} = \frac{1}{(z-\pi i)^2} + O((z-\pi i)^{-1}),
$$
and thus the order of the pole is 2.  Its residue is
$$
\frac{1}{(2-1)!}\frac{d}{dz}\Big|_{z=\pi i}(z-\pi i)^2f(z) = -\pi \exp(i\pi^2)
$$
(after a long calculation) and we have finally $I=-\exp(i\pi^2)/2i(1+\exp(-2\pi))$.
My question is whether this derivation is correct.  I would also like to know if there are easier ways to do this (especially, those of calculating the residue).
I would appreciate if you could help me work on this problem.

\begin{eqnarray*}
\int_{-\infty}^{\infty}
{{\rm e}^{\left(1\ +\ {\rm i}\right)x} \over \left(1 + {\rm e}^{x}\right)^2}\,{\rm d}x
& = &
\int_{0}^{\infty}\left\lbrack%
{{\rm e}^{\left(-1\ +\ {\rm i}\right)x} \over \left(1 + {\rm e}^{-x}\right)^2}
+
{{\rm e}^{-\left(1\ +\ {\rm i}\right)x} \over \left(1 + {\rm e}^{-x}\right)^2}
\right\rbrack
{\rm d}x
\\
& = &
2\,\Re\int_{0}^{\infty}
{{\rm e}^{-\left(1\ -\ {\rm i}\right)x} \over \left(1 + {\rm e}^{-x}\right)^2}\,{\rm d}x
=
2\,\Re\int_{0}^{\infty}
{\rm e}^{-\left(1\ -\ {\rm i}\right)x}
\sum_{n = 1}^{\infty}\left(-1\right)^{n}\,n\,{\rm e}^{-\left(n - 1\right)x}\,{\rm d}x
\\
& = &
2\,\Re\sum_{n = 1}^{\infty}\left(-1\right)^{n}\,n
\int_{0}^{\infty}{\rm e}^{-\left(n - {\rm i}\right)x}
=
2\,\Re\sum_{n = 1}^{\infty}\left(-1\right)^{n}\,{n \over n - {\rm i}}
\\
& = &
2\,\Re\sum_{n = 1}^{\infty}\left(%
-\,{2n - 1\over 2n - 1 - {\rm i}} + {2n \over 2n - {\rm i}}
\right)
\\
& = &
2\,\Re\sum_{n = 1}^{\infty}\left\lbrack%
\left(-1 - {{\rm i} \over 2n - 1 - {\rm i}}\right)
+
\left(1
+
{{\rm i} \over 2n - {\rm i}}\right)
\right\rbrack
\\
& = &
2\,\Im\sum_{n = 1}^{\infty}\left(
{1 \over -{\rm i} + 2n} - {1 \over -{\rm i} + 2n - 1}
\right)
=
2\,\Im\sum_{n = 1}^{\infty}
{\left(-1\right)^{n} \over -{\rm i} + n}
\\
& = &
2\,\Im\left\lbrack\sum_{n = 0}^{\infty}
{\left(-1\right)^{n} \over -{\rm i} + n} - {1 \over -{\rm i}}
\right\rbrack
=
-2 + 2\,\Im\sum_{n = 0}^{\infty}{\left(-1\right)^{n} \over -{\rm i} + n}
\\[1cm]&&
\end{eqnarray*}
$$
\int_{-\infty}^{\infty}
{{\rm e}^{\left(1\ +\ {\rm i}\right)x} \over \left(1 + {\rm e}^{x}\right)^2}\,{\rm d}x
=
-2 + 2\,\Im\beta\left(-{\rm i}\right)
$$
