So I am a physicist and have just started a phd related to qft, we often have integrals of the following form: $$ \int dx\ e^{imx^2} $$ which is undefined. However if we take the standard gaussian integral $$ \int dx\ e^{-ax^2}=\sqrt{2\pi/a} $$ this can be analytically continued to $a\to -ia$ and hence we can get an answer for the first integral.
Why does this give us a solution to the first integral, why, just because the solution can be analytically continued, does it mean we can continue the integral itself?
Actually $\int_{-\infty}^\infty e^{imz^2}\; dz$ does exist as an improper integral for real $m$, i.e. $$ \int_{-A}^B e^{imz^2}\; dz = \sqrt{\frac{\pi}{-4im}} (\text{erf}(\sqrt{-im} B) + \text{erf}(\sqrt{-im} A))$$ and the limit of this as $A,B \to +\infty$ is $\sqrt{i\pi/m}$. The fact that this is the same as the limit of $\int_{-\infty}^\infty e^{imz^2}\; dz$ as $\text{Im}(m) \to 0+$ involves an interchange of limits whose validity is not obvious, but can be proven.