What is the growth rate of $$S_d(M)=\sum_{n=1}^M n^d e(\frac{n^2}{2M})$$$$S_d(M)=\sum_{n=1}^M n^d e\left(\frac{n^2}{2M}\right)$$ where $M$ is an even integer. My numerical experiments show that $$\frac{S_d(M)}{M^{d+\frac{1}{2}}}\approx e^{\frac{\pi i}{4}}\cdot C(M)$$ where $C(M)\in \mathbf{R},$ $|C(M)|\le O(1).$