Analytic continuation of convergent integral I was trying to solve the following integral:
$$I = \oint _{|z|=1}\frac{dz}{2 \pi i z}\int_{0}^{\infty} dr \dfrac{e^{-\tfrac{r^2}{z^2}}r^{2n+1}}{z^2(z-1)} $$

*

*The singular structure in the $z$ integral is coming from the $z= 0$ and $z = 1$ points.

*From the term $ e^{-\tfrac{r^2}{z^2}}$, the integral over $r$ is giving a divergent contribution for $\tfrac{\pi}{4} \leq \mathop{\mathrm{Arg}}(z) \leq \tfrac{3\pi}{4} \; \; \& \; \; \tfrac{5 \pi}{4} \leq \mathop{\mathrm{Arg}}(z) \leq \tfrac{7\pi}{4}  $
My question is, can we somehow give some argument like analytic continuation or modify the contour so that we can assign some convergent value to $I$?
 A: Technically, your integral is not well-defined because the path goes through $z=1$; the remedy I see presently (unless you have a definition for the contour going through $z=1$), is to move the contour slightly within the unit disc (and slightly outside it) and compute the integral as the average of the two or as either obtained values (I presume the contour is counterclockwise and $n$ is a nonnegative integer):
$$I=\lim_{\epsilon \to 0}\int_0^\infty r^{2n+1}\left(\frac{1}{2\pi i}\oint_{|z|=1\pm\epsilon}\frac{e^{-r^2/z^2}}{z^3(z-1)}dz\right)dr\,,$$
where $\epsilon\in(0,1)$. If we choose $\pm = +$, then we can easily determine (say by series expansion) that the contour integral vanishes because the poles within the interior of the contour are $z=0$ and $z=1$, whereas if we choose $\pm = -$, the contour integral takes the value $-e^{-r^2}$, arising from the sole pole $z=0$ in the interior of the contour. The integral then reduces to
$$I=- \int_0^\infty r^{2n+1}e^{-r^2}dr=-\frac{1}{2}n!\,,$$
where the evaluation is well-known (see for instance, https://en.m.wikipedia.org/wiki/Gaussian_integral).
