We know that $$\int_{-\infty}^{\infty}e^{-x^2}dx = \sqrt{\pi}$$
How can I use it to find $$\int_{-\infty}^{\infty}e^{-x^2+ix}dx$$
Is it legal in this case to make following variable substitution: $t = x - \frac{i}{2}$? How and why will the integration contour change?
Use the Feynman trick if you want to avoid complex integrals. Define $$f(\alpha)=\int_{\mathbb R} e^{-x^2+\alpha x}dx$$ Then $$\begin{split} f^\prime (\alpha)&=\int_{\mathbb R} xe^{-x^2+\alpha x} dx \\ &= -\frac 1 2\int_{\mathbb R} \left(-2x +\alpha\right)e^{-x^2+\alpha x} dx+\frac \alpha 2 f(\alpha)\\ &= \left [ e^{-x^2+\alpha x} \right ]_{-\infty}^{+\infty} +\frac \alpha 2 f(\alpha)\\ &=\frac \alpha 2 f(\alpha) \end{split}$$ Solving this O.D.E. yields to $$f(\alpha)=Ce^{\frac {\alpha^2}4}$$ Since $f(0)=\sqrt{\pi}$, we have $f(\alpha)=\sqrt{\pi}e^{\frac{\alpha^2}4}$ and your integral is $\sqrt{\pi}e^{-\frac 1 4}$