I've read that the residue theorem would help to calculate $$I:=\displaystyle\int_{-\infty}^\infty\underbrace{\exp\left\{-\frac{1}{2}(x-it)^2\right\}}_{=:f(x)}dx$$ Since $f$ is an entire function $\oint_\gamma f=0$ for every closed path $\gamma$ (Cauchy's integral theorem would also yield this information).
So, of course, we can consider the composition $\gamma$ of two paths $\gamma_1(s):=s$, $s\in[-R,R]$, and $\gamma_2(s):=Re^{is}$, $s\in[0,2\pi]$, for some $R>0$. It holds $$0=\oint_\gamma f(z)dz=\int_{-R}^Rf(s)\;ds+iR\int_0^{2\pi}\exp\left\{-\frac{1}{2}(Re^{is}-it)^2+is\right\}ds$$ If we could calculate the second integral, we could calculate $I$. However, it doesn't seem to be helpful to consider that integral instead of the original one.
So, do I miss anything? What's the easiest way to obtain $I$?
Consider the rectangular path with vertices at $-R,\, R,\, R+it,\, -R+it$. When $R\to \infty$, the integrals over the vertical sides tend to $0$ by the standard estimate, and you are left with
$$\int_{-\infty}^\infty \exp \left\{-\frac{1}{2}(x-it)^2\right\}\,dx = \int_{-\infty +it}^{\infty +it} \exp \left\{-\frac{1}{2}(z-it)^2\right\}\,dz,$$
where the latter integral is straightforwardly an integral well-known from real analysis.
The idea is to use the Cauchy integral theorem to shift the contour in such a way that the integrand becomes simpler.