$\int\limits_{-\infty}^\infty \frac{1}{e^{x^{2}}+1}dx$ I am trying to solve 
$$\int\limits_{-\infty}^\infty \frac{1}{e^{x^{2}}+1}dx$$
Process:
First define a contour $\Gamma$ as a semi-circle with radius $R$.
So $$\int_{\Gamma}\frac{1}{e^{x^{2}}+1}dx=\int_{Arc}\frac{1}{e^{x^{2}}+1}dx+\int_{-\infty}^\infty\frac{1}{e^{x^{2}}+1}dx$$
$$\int_{Arc}\frac{1}{e^{x^{2}}+1}dx=\int_{0}^\pi \frac{iRe^{i\theta}}{e^{{Re^{i\theta}}^{2}}+1}d\theta$$ As $R\to\infty$,  $\int_{Arc}\to0$.
$$\int_{\Gamma}\frac{1}{e^{x^{2}}+1}dx=\int_{-\infty}^\infty\frac{1}{e^{x^{2}}+1}dx$$
$$\int_{\Gamma}\frac{1}{e^{x^{2}}+1}dx=2\pi i\sum \rm Res$$
$\frac{1}{e^{x^{2}}+1}$ has first order poles at $\sqrt{\pm (2n+1)\pi i}$ so using L'Hopital's the residues become $$-\frac{1}{2\sqrt{\pm (2n+1)\pi i}}$$
So
$$\int_{-\infty}^\infty\frac{1}{e^{x^{2}}+1}dx=-\sqrt{\pi i}\sum\frac{1}{\sqrt{\pm (2n+1)}}$$
However, this is where I run into a problem since I get a complex answer whereas the integral should be a real value. If anyone can tell me where I went wrong and the actual value of the integral I would greatly appreciate it.
 A: Note that we can write $\frac{1}{1+e^{x^2}}=\sum_{n=0}^\infty (-1)^n e^{-(n+1)x^2}$.  Hence, we have 
$$\int_{-\infty}^\infty \frac{1}{1+e^{x^2}}\,dx=\sqrt{\pi}\sum_{n=1}^\infty (-1)^{n-1}\frac1{\sqrt n}=\sqrt \pi (1-\sqrt 2)\zeta(1/2)$$
as expected!
A: Mistake 1. The contour integral over the arc does not vanish as $R\to\infty$. In fact, along the radii $R_n = \sqrt{(n+\frac{1}{2})\pi}$ we can check that
$$ \frac{1}{R_n} \int_{\text{arc}} \frac{dz}{e^{z^2} + 1}
= \int_{0}^{\pi} \frac{ie^{i\theta}}{e^{R_n^2 e^{2i\theta}} + 1} \, d\theta
\xrightarrow[n\to\infty]{} \int_{-\frac{\pi}{4}}^{\frac{3\pi}{4}} ie^{i\theta} \, d\theta
= -\sqrt{2}. $$
So the integral over the arc of radius $R_n$ diverges to $-\infty$ at the speed proportional to the radius of the arc. This means that there should be a massive cancellation between two terms of the RHS of
$$ \int_{-R_n}^{R_n} \frac{dz}{e^{z^2}+1}
= 2\pi i \left( \sum_{z_0\ : \ \text{zeros in } \Gamma} \underset{z=z_0}{\operatorname{Res}} \, \frac{1}{e^{z^2}+1} \right) - \int_{\text{arc}} \frac{dz}{e^{z^2} + 1} $$
To put simple, it is a $\infty-\infty$ indeterminate and you killed one infinity. 
Mistake 2. Another mistake you made is that poles of $1/(e^{z^2+}+1)$ in the upper half-plane are
$$\sqrt{(2n+1)\pi i} \quad \text{and} \quad -\sqrt{-(2n+1)\pi i}, \quad n \geq 0$$
if you are using the principal square root.
Conclusion. Assume that the integral over the arc has the asymptotics $-\sqrt{2}R_n + o(1)$ as $n\to\infty$ and $D_n$ denotes the upper half-disk of radius $R_n$, then
$$ 2\pi i \left( \sum_{z_0\ : \ \text{zeros in } D_{2n}} \underset{z=z_0}{\operatorname{Res}} \, \frac{1}{e^{z^2}+1} \right) = -\sqrt{2\pi} \sum_{k=1}^{n} \frac{1}{\sqrt{2k-1}}, $$
and hence
$$ \int_{-R_{2n}}^{R_{2n}} \frac{dz}{e^{z^2}+1}
= -\sqrt{2\pi} \sum_{k=1}^{n} \frac{1}{\sqrt{2k-1}} + \sqrt{2\left( 2n+\tfrac{1}{2} \right)\pi} + o(1). $$
It can be shown that this converges to $(1-\sqrt{2})\sqrt{\pi}\zeta(\frac{1}{2})$ as claimed.
A: For any $s$ such that $\text{Re}(s)>1$ we have $\zeta(s)=\sum_{n\geq 1}\frac{1}{n^s} $ and by defining $\eta(s)=\sum_{n\geq 1}\frac{(-1)^{n+1}}{n^s}$ we also have $\eta(s)=\left(1-\frac{2}{2^s}\right)\zeta(s)$. Since the series $\sum_{n\geq 1}\frac{(-1)^{n+1}}{n^s}$ is conditionally convergent as soon as $\text{Re}(s)>0$, we have the following analytic continuation for the $\zeta$ function:
$$ \forall s\in(0,1),\qquad \begin{eqnarray*}\zeta(s)&=&\left(1-\frac{2}{2^s}\right)^{-1}\sum_{n\geq 1}\int_{0}^{+\infty}\frac{(-1)^{n+1}u^{s-1}}{\Gamma(s)}e^{-nu}\,du\\&=&\frac{1}{\Gamma(s)}\left(1-\frac{2}{2^s}\right)^{-1}\int_{0}^{+\infty}\frac{u^{s-1}}{e^u+1}\,du\\&=&\frac{2}{\Gamma(s)}\left(1-\frac{2}{2^s}\right)^{-1}\int_{0}^{+\infty}\frac{x^{2s-1}}{e^{x^2}+1}\,dx\end{eqnarray*} $$
and by evaluating at $s=\frac{1}{2}$
$$ \int_{-\infty}^{+\infty}\frac{dx}{e^{x^2}+1} = \sqrt{\pi}(1-\sqrt{2})\,\zeta\left(\frac{1}{2}\right)=\sqrt{\pi}\sum_{n\geq 1}\frac{(-1)^{n+1}}{\sqrt{n}} $$
where the first equality has already been stated by Sangchul Lee in the comments and the second equality follows from the definition of $\eta(s)$.
A: You should avoid square roots when dealing with complex numbers, and you especially should avoid using sqrt(a*b) = sqrt(a)*sqrt(b)
${e^{x^{2}}+1} = 0$ 
$x^{2} = (2n+1)\pi i$ 
$x^{2} = (2n+1)\pi e^{(2n+1)\pi i}$ 
$x = \sqrt{(2n+1)\pi} e^{(n+\frac{1}{2})\pi i}$ (note that only real numbers are under the square root sign)
$x = \sqrt{(2n+1)\pi} e^{(n+\frac{1}{2})\pi i}$
Res = $\frac{2\sqrt{\pi}}{\sqrt{(2n+1)}} e^{((n+\frac{1}{2})\pi -1)i}$
