$\int_{-\infty}^{+\infty} e^{-x^2} dx$ with complex analysis
What follows is a list of solutions that I enjoy, and use complex analysis either implicitly or explicitly. I will update the list as I come up with more. (Note: Solution 4 is my favorite, and is completely complex analysis oriented. I also quite like Solution 6.)
First, let $u=x^{2}$, $du=2xdx$. Then our integral becomes $$\int_{-\infty}^\infty e^{-x^2}dx=\int_{0}^{\infty}u^{-\frac{1}{2}}e^{-u}du=\Gamma\left(\frac{1}{2}\right).$$ where $\Gamma(s)$ is the Gamma function.
Solution 1: Since $$\Gamma(1-s)\Gamma(s)=\frac{\pi}{\sin\pi s}$$ for all complex $s$, we conclude $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$
Solution 2: Recall the Beta function, $$\text{B}(x,y)=\int_{0}^{1}t^{x-1}(1-t)^{y-1}dt=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}.$$ Setting $x=y=\frac{1}{2}$ we have
$$ \left(\Gamma\left(\frac{1}{2}\right)\right)^{2}=\int_{0}^{1}\frac{1}{\sqrt{t(1-t)}}dt.$$
To evaluate this, set $t=\sin^{2}(x)$ to find $$\left(\Gamma\left(\frac{1}{2}\right)\right)^{2}=\int_{0}^{\frac{\pi}{2}}\frac{2\sin x\cos x}{\sin x\cos x}dt=\pi.$$ Alternatively, we could evaluate the last integral by choosing branch's such that the integrand is analytic on $\mathbb{C}-[0,1]$ and then integrating around this cut. (The residue then comes from the residue at infinity)
Solution 3: Setting $s=\frac{1}{2}$ in the duplication formula, $$\Gamma(s)\Gamma\left(s+\frac{1}{2}\right)=\sqrt{\pi}2^{1-2s}\Gamma(2s),$$ yields $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$
Solution 4: My personal favorite: Recall the functional equation for the zeta function, namely that $$\pi^{-\frac{z}{2}}\Gamma\left(\frac{z}{2}\right)\zeta(z)=\pi^{-\frac{1-z}{2}}\Gamma\left(\frac{1-z}{2}\right)\zeta(1-z).$$ Taking the limit as $z\rightarrow1$, we know that $\zeta(z)\sim\frac{1}{z-1}$ and $\Gamma\left(\frac{1-z}{2}\right)\sim2\frac{1}{\left(z-1\right)}$ so that we must have the equality $$\pi^{-\frac{1}{2}}\Gamma\left(\frac{1}{2}\right)=2\zeta(0).$$ By taking the limit in the right half plane as $s\rightarrow0$ using the identity $$\zeta(s)=\frac{s}{s-1}-s\int_{1}^{\infty}\{u\}u^{-s}du,$$ which holds for $\sigma>0$, we can find that $\zeta(0)=\frac{1}{2}.$ (notice the pole/zero cancellation). Consequently $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$
Solution 5: From complex integration, for $a,b>0$ we have the identity $$\int_{-\infty}^{\infty}(1-ix)^{-a}(1+ix)^{-b}dx=\frac{2^{2-a-b}\pi\Gamma(a+b-1)}{\Gamma(a)\Gamma(b)}.$$ Set $a=\frac{1}{2},b=\frac{3}{2}$ to find that $$ \int_{-\infty}^{\infty}\frac{1-ix}{\left(1+x^{2}\right)^{\frac{3}{2}}}dx=\frac{2\pi}{\Gamma\left(\frac{1}{2}\right)^{2}}.$$ Hence $$\int_{0}^{\infty}\frac{1}{\left(1+x^{2}\right)^{\frac{3}{2}}}dx=\frac{\pi}{\Gamma\left(\frac{1}{2}\right)^{2}}.$$ Since the integrand on left hand side has anti derivative $\frac{x}{\sqrt{x^{2}+1}}+C$, it follows that the integral is $1$ and hence$$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$
Solution 6: More with the Beta function. Consider the Mellin Transform $$\mathcal{M}\left(\frac{1}{\left(1+t\right)^{a}}\right)(z):=\int_{0}^{\infty}\frac{t^{z-1}}{(1+t)^{a}}dt=\text{B}(a-z,z).$$ The last equality follows by substituting $v=\frac{1}{1+t}$, and then rewriting the integral as $\int_{0}^{1}v^{a-z-1}(1-v)^{z-1}dv.$ Now, plug in $a=1$ and $z=\frac{1}{2}$ to get $$\int_{0}^{\infty}\frac{1}{\sqrt{t}(1+t)}dt=\Gamma\left(\frac{1}{2}\right)^{2}$$ and then let $t=x^{2}$ to find $$ 2\int_{0}^{\infty}\frac{1}{1+x^{2}}dx=\pi=\Gamma\left(\frac{1}{2}\right)^{2}. $$
Solution 7: We can also prove the result by using Stirling's formula. Admittedly, this isn't really using complex analysis, but I find it interesting.
Since $z\Gamma(z)=\Gamma(z+1)$ we see that $$ \Gamma\left(n+\frac{1}{2}\right)=\Gamma\left(\frac{1}{2}\right)\cdot\left(\frac{1}{2}\right)\left(\frac{3}{2}\right)\cdots\left(\frac{2n-1}{2}\right)=\Gamma\left(\frac{1}{2}\right)\left(\frac{(2n)!}{n!4^{n}}\right)=\Gamma\left(\frac{1}{2}\right)\binom{2n}{n}\frac{n!}{4^{n}}. $$ By Stirling's formula, $$ \binom{2n}{n}\frac{1}{4^{n}}\sim\frac{1}{\sqrt{\pi n}}\ \text{as}\ n\rightarrow\infty $$ and $$ \frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\sim\frac{1}{\sqrt{ne}}\frac{\left(n+\frac{1}{2}\right)^{n}}{n^{n}}. $$ Using the fact that $\lim_{n\rightarrow\infty}\left(1+\frac{a}{n}\right)^{n}=e^{a}$, it then follows that $$ \frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\sim\frac{1}{\sqrt{n}}. $$ Consequently, taking the limit as $n\rightarrow\infty$ in the formula $$\Gamma\left(\frac{1}{2}\right)=\frac{\Gamma\left(n+\frac{1}{2}\right)}{n!}\frac{4^{n}}{\binom{2n}{n}}$$ yields $$\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}.$$
Hope that helps,
Remark: All of the formulas used here can be proven without use the fact that $\Gamma(1/2)=\sqrt{\pi}$, so that none of these are cyclic. This is mainly worth pointing out for $4$.
Edit: I put what were solutions 2 and 3 together since they were not different.
This needs some trickery since $e^{-z^2}$ has no poles.
The easiest proof I know can be found in Remmert's book (it's in §14.3.3 on page 330 of the German edition, but, as usual, Google doesn't let me look at the page I'm interested in) and seems to be to be due to H. Kneser (since Remmert doesn't give any other source).
So here's the deal:
Put $$g(z) = \frac{e^{-z^2}}{1+ e^{-2az}}\quad \text{with }\quad a = (1+i)\sqrt{\frac{\pi}{2}}.$$ From $a^2 = i\pi$ it is easy to see that $$g(z) - g(z+a) = e^{-z^2}$$ and that the poles of $g$ are simple and located precisely at the points $-\frac{1}{2}a + na$ with $n \in \mathbb{Z}$.
Now integrate the function $g$ over the rectangle with corners $-r,s, s+i\operatorname{Im}(a),-r+i\operatorname{Im}(a)$ with $r,s \gt 0$ real numbers. Observe that the only pole of $g$ inside this rectangle is the one located at $\frac{a}{2}$, and its residue is $$\operatorname{res}_{\frac{a}{2}} g = \frac{e^{-\frac{1}{4}a^2}}{-2ae^{-a^2}} = \frac{-i}{2\sqrt{\pi}},$$ using the usual formula $\operatorname{res}_{x} \frac{f}{h} = \frac{f(x)}{h'(x)}$ if $h$ has a simple zero at $x$ and $f(x) \neq 0$.
Using the residue theorem and the periodicity $g(z) - g(z+a) = e^{-z^2}$ one then easily verifies that $$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \lim_{r,s \to \infty} \int_{-r}^{s} e^{-x^2}\,dx = 2\pi i \, \operatorname{res}_{\frac{a}{2}} g = \sqrt{\pi}$$ since the integrals along the vertical sides of the rectangles converge to zero as $r,s \to \infty$.
Remmert also mentions that it was often claimed in the older literature that it was impossible to obtain this formula from the calculus of residues.
Added.
Remmert also refers to G. Pólya's article Remarks on Computing the Probability Integral in One and Two Dimensions, Proc. [First] Berkeley Symp. on Math. Statist. and Prob. (Univ. of Calif. Press, 1949), 63-78, where another method is shown: In section 5 of that article (on p. 68f) Pólya integrates the function $e^{i\pi z^2} \tan{(\pi z)}$ over the parallelogram with corners $R+iR$, $-R-iR$, $-R+1-iR$, $R+1+iR$ to derive the desired formula.
$\text{MR}1641980\, (99\text{h}:26002)$
Desbrow, Darrell.
On Evaluating $\displaystyle\int_{-\infty}^\infty e^{ax(x-2b)}\, dx$ by Contour Integration Round a Parallelogram.
Amer. Math. Monthly $105\, (1998)$, no. $8,\, 726–731$.