Evaluating $\int\limits_0^\infty \frac{e^x}{1+e^{2x}}\mathrm dx$, alternate methods Problem:
Evaluate $$\displaystyle\int\limits_0^\infty \frac{e^x}{1+e^{2x}}\mathrm dx$$
My progress: 
I have actually solved the problem, but I fear that I may not have used the "desired" methods.
Using substitution $u = e^x$, we can rewrite the integral and get $$ \arctan(e^x)\bigg|_0^\infty $$
Then we need to evaluate the limit $$\displaystyle\left(\lim\limits_{x\to\infty}\arctan(e^x)\right) - \arctan(e^0)$$
Now, this is where I think my solution differs from the intended method (which I don't know what is).
When I evaluate the above limit, I realize that $\tan(x)$ has a vertical asymptote for $x = \frac\pi2$, which means that $\arctan(x)$ has a horizontal asymptote for $y = \frac\pi2$, and is continuously increasing.
Then, since $x\to\infty \Rightarrow e^x\to\infty$, we can conclude that $$\displaystyle\lim\limits_{x\to\infty}\arctan(e^x) = \frac\pi2$$ which gives the final answer $$\displaystyle\int\limits_0^\infty \frac{e^x}{1+e^{2x}}\mathrm dx = \left(\lim\limits_{x\to\infty}\arctan(e^x)\right) - \arctan(e^0) = \frac\pi2 - \frac\pi4 = \underline{\underline{\frac\pi4}}$$
My question:
Is there a more "calculating" way of evaluating the aforementioned limit? I.e. using some general rules of limits rather than intuition? Bear in mind, I like my own solution. It was satisfying. I just feel like there is something else I should know, which I'm missing out on.
 A: If you want to avoid the limit to infinity, you can use the change of variable $e^x=1/u$ instead, and get$$\int_0^\infty\frac{e^x}{1+e^{2x}}dx=\int_1^0\frac{-\frac{du}{u^2}}{1+\frac1{u^2}}=-\int_1^0\frac{du}{1+u^2}=-\arctan(u)\Big|_1^0=\frac\pi4.$$
A: If you know complex analysis, you can use the residue theorem.  Consider
$$ \oint_C \frac{dz}{\cos{z}} $$
where $C$ is a rectangle with vertices in the complex plane $-i R$, $\pi-i R$, $\pi+i R$,$i R$.  The contour integral is then
$$\int_0^{\pi} \frac{dx}{\cos{(x-i R)}} + i \int_{-R}^R \frac{dy}{\cos{(\pi+i y)}} + \int_{\pi}^0 \frac{dx}{\cos{(x+i R)}}+ i \int_{R}^{-R} \frac{dy}{\cos{(i y)}}$$
Now, the integrals over $x$ vanish because they combine to form
$$- i 2 \int_0^{\pi} dx \frac{\sinh{R} \sin{x}}{\sinh^2{R}+\cos^2{x}} = - i 2 \arctan{\left ( \frac1{\sinh{R}}\right )} $$
which clearly vanishes as $R \to \infty$.  Thus, in this limit, the contour integral is equal to
$$i \int_{-\infty}^{\infty} dy \left ( \frac1{\cos{(\pi+i y)}} - \frac1{\cos{(i y)}} \right ) = -i 2 \int_{-\infty}^{\infty} \frac{dy}{\cosh{y}}$$
By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the residue of $1/\cos{z}$ at the pole $z=\pi/2$ (the only pole within $C$), which is $1/(-\sin{(\pi/2)}) = -1$.  Thus,
$$ -i 2 \int_{-\infty}^{\infty} \frac{dy}{\cosh{y}} = i 2 \pi (-1) $$
and using the exponential definition of cosh, we get that
$$\int_0^{\infty} dy \frac{e^y}{1+e^{2 y}} = \frac{\pi}{4} $$
A: Sorry for being late
$$
\begin{aligned}
\int_0^{\infty} \frac{e^x}{1+e^{2 x}} d x & =\int_0^{\infty} \frac{1}{e^x+e^{-x}} d x \\
& =\frac{1}{2} \int_0^{\infty} \operatorname{sech} x d x \\
& =\frac{1}{2}\left[\tan ^{-1}\left(\tanh \left(\frac{x}{2}\right)\right)\right]_0^{\infty} \\
& =\frac{\pi}{4}
\end{aligned}
$$
A: Another way not using the arctan is given by realizing that
$$
\mathrm e^x\left(\frac{1}{1+\mathrm e^{2x}}\right) = \mathrm e^x\left(\frac{1}{2(1+\mathrm{ie}^x)}+\frac{1}{2(1-\mathrm{ie}^x)}\right)
$$
Then the substitution $u=\mathrm e^x$ gives
$$
\int_1^\infty\left(\frac{1}{2+2\mathrm{i}u}+\frac{1}{2-2\mathrm i u}\right)\mathrm du=\left[-\frac{1}{2}\mathrm i\ln\left(\frac{\mathrm i}{2}+\frac{1}{\mathrm i+u}\right)\right]_1^\infty=\frac{\pi}{4}.$$
EDIT: I need to add some details concerning the complex logarithm: Observe that the argument $z=\frac{\mathrm i}{2}+\frac{1}{\mathrm i+u}$ satisfies $0\leqslant \mathrm{Im}(z)\leqslant\frac{1}{2}$ hence you can choose the principal branch of the logarithm and the limit is found using the continuity of the principal branch of the logarithm. I hope this clarifies the procedure.
A: Another way: note that on $(0,\infty)$, $e^{-2x}<1$, so we can use the binomial theorem, and interchange the order of summation and integration, to get
$$ \int_0^{\infty} \frac{e^x}{e^{2x}+1} \, dx = \int_0^{\infty} \frac{e^{-x}}{1+e^{-2x}} \, dx = \int_0^{\infty} \sum_{k=0}^{\infty} (-1)^{k}e^{(2k+1)x} \, dx \\
= \sum_{k=0}^{\infty}(-1)^{k} \int_0^{\infty}e^{(2k+1)x} \, dx = \sum_{k=0}^{\infty}\frac{(-1)^{k}}{2k+1} = \frac{\pi}{4}. $$
Justifying the interchange is a matter of bounding the "remainder" integral,
$$ \int_0^{\infty} \frac{e^{-2(n+1)x}}{1+e^{-2x}} \, dx, $$
which is easy to do by noting that the denominator is larger than $1$, so the remainder is smaller than $1/(2n+2)$.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[5px,#ffd]{\int_{0}^{\infty}{\expo{x} \over
1 + \expo{2x}}\,\dd x} =
\int_{0}^{\infty}{\expo{-x} \over 1 + \expo{-2x}}
\,\dd x =
\int_{0}^{\infty}{\expo{-x} - \expo{-3x}\over 1 - \expo{-4x}}
\,\dd x
\\[5mm] \stackrel{4x\ \mapsto\ x}{=}\,\,\,&
{1 \over 4}\int_{0}^{\infty}{\expo{-x/4} - \expo{-3x/4} \over
1 - \expo{-x}}\,\dd x
\\[5mm] = &\
{1 \over 4}\pars{%
\int_{0}^{\infty}{\expo{-x} - \expo{-3x/4} \over
1 - \expo{-x}}\,\dd x -
\int_{0}^{\infty}{\expo{-x} - \expo{-x/4} \over
1 - \expo{-x}}\,\dd x}
\\[5mm] = &\
{1 \over 4}\bracks{\Psi\pars{3 \over 4} -
\Psi\pars{1 \over 4}}
\end{align}
See A & S Table $\ds{\color{black}{\bf 6.3.22}}$ identity.
With the Euler Reflection Formula:
\begin{align}
& \mbox{} \\
&\bbox[5px,#ffd]{\int_{0}^{\infty}{\expo{x} \over
1 + \expo{2x}}\,\dd x} =
{1 \over 4}\bracks{\pi\cot\pars{\pi \over 4}} =
\bbx{\pi \over 4} \\ &
\end{align}
