Let $d, \ell$ be integers, $\left(\frac{\cdot}{\cdot}\right)$ be the Jacobi symbol, I would like to compute the following Gauss sum. $$G_{\left(\frac{\cdot}{d}\right)}(\ell):=\sum_{\alpha\bmod(d)}\left(\frac{\alpha}{d}\right)e\left(\frac{\alpha\ell}{d}\right).$$ Here $e(x):=e^{2\pi ix}$.
For $d$ square-free and odd, this is the same as the quadratic Gauss sum, $$G_{\left(\frac{\cdot}{d}\right)}(\ell)=G(\ell,0,d)=\sum_{\alpha\bmod(d)}e\left(\frac{\alpha^2\ell}{d}\right)=\epsilon_d\sqrt{d}\left(\frac{\ell}{d}\right)$$ where $\epsilon_d$ is 1 if $d\equiv1\bmod{4}$ and $i$ if $d\equiv3\bmod{4}$. This can be proved by Chinese remainder theorem, for example if $d=pq$ where $p,q$ are odd primes, we have $$G_{\left(\frac{\cdot}{pq}\right)}(\ell)=\sum_{\alpha\bmod{pq}}\left(\frac{\alpha}{pq}\right)e\left(\frac{\alpha\ell}{pq}\right)=\sum_{\beta\bmod{p}}\left(\frac{\beta}{p}\right)e\left(\frac{\beta\overline{q}\ell}{p}\right)\sum_{\gamma\bmod{q}}\left(\frac{\gamma}{q}\right)e\left(\frac{\gamma\overline{p}\ell}{q}\right)$$ Then one can check by explicit evaluations that the product of Gauss sum on the RHS matches.
Now if $d=p^n$ is an odd prime power, then we have for odd n, $$\begin{align}\sum_{\alpha\bmod{p^n}}\left(\frac{\alpha}{p^n}\right)e\left(\frac{\alpha\ell}{p^n}\right)&=\sum_{\alpha\bmod{p}}\sum_{\beta\bmod{p^{n-1}}}\left(\frac{\alpha}{p}\right)e\left(\frac{(\alpha+p\beta)\ell}{p^n}\right)\\ &=p^{n-1}\sum_{\alpha\bmod{p}}\left(\frac{\alpha}{p}\right)e\left(\frac{\alpha\ell}{p^n}\right)\delta(p^{n-1}|\ell)\\ &=p^{n-\frac{1}{2}}\epsilon_p\left(\frac{\frac{\ell}{p^{n-1}}}{p}\right)\end{align}$$ if $p^{n-1}|\ell$ and $0$ otherwise. (Here $\delta(c|\ell)$ is 1 if $c|\ell$ and $0$ otherwise.)
For $d=p^n$ with $n$ even, we have by mobius inversion, $$\begin{align}\sum_{\substack{\alpha\bmod{p^n}\\(\alpha,p)=1}}e\left(\frac{\alpha\ell}{p^n}\right)&=\sum_{bc=p^n}\mu(b)\sum_{\alpha(c)}e\left(\frac{\alpha\ell}{c}\right)\\ &=\sum_{bc=n}\mu(b)c\delta(c|\ell)=p^n\delta(p^n|\ell)-p^{n-1}\delta(p^{n-1}|\ell) \end{align}$$
In general, we can apply the above to split $d$ into primes powers, but it seems a bit messy, I hope I didn't make any mistakes and 2 has to be done separately as well.
My question is if there is a formula for general $d$. I assume it's not going to be as simple as the squarefree odd case, but has anyone computed and written down a close form before? Any comments or reference related to the above is appreciated, thanks!