In a previous question How to evaluate the Gauss sum using Mordell's Trick? I was trying to evaluate the integral
$$\int_\gamma \exp(2 \pi i z^2 / n)(\exp(2 \pi i z) + 1) dz$$
across the line $\gamma(t) = i t$ where $t \in [-R,R]$. $\gamma'(t) = i$ so I can change this from a contour integral to an integral across a range:
$$\int_{-R}^{R} i \exp(- 2 \pi i z^2 / n)(\exp(- 2 \pi z) + 1)$$
but it was said that this integral does not converge when $R$ tends to infinity. I am confused because I believe this integral should equal something else that does converge. Can anybody explain what I did wrong? How is it possible that this integral diverges when an equivalent integral converges?