How should I estimate the following integral $$I = \int_0^1 \left( \sum_{n=0}^{p-1} e(n^2t) \right)^2 dt $$ where $p$ is a prime?
Here is the method I followed: \begin{align*} I & = \int_0^1 \left( 1+ \sum_{n=1}^{p-1} e(n^2t) \right)^2 dt \\ & = 1 + 2 \sum_{n=1}^{p-1} \left( \int_0^1 e(n^2t) dt \right) + \int_0^1 \left( \sum_{n=1}^{p-1} e(n^2t) \right)^2 dt \\ & = 1 + 2 \sum_{n=1}^{p-1} \left( \frac{e(n^2)-1}{2\pi i n^2} \right) + \int_0^1 \left( \sum_{n=1}^{p-1} e(n^2t) \right)^2 dt \\ & = 1+O((p-1)^{1+\epsilon}) \end{align*} where the third term is estimated using Hua's lemma.
This estimate is not good enough for my purpose. Is it possible to get a better error term than the one here?