Cancellation in a particular sum In an attempt to compute cycle counts in an of a certain number theoretic graph, the following estimate was needed.
It is true that
$$\bigg|\sum_{a,b,c\in \mathbb{Z}/p\mathbb{Z}}\bigg(\sum_{d=1}^{p-1}\bigg(\frac{d}{p}\bigg)w^{-d-(a^2+b^2+c^2)/d}\bigg)^3\bigg| = o(p^{9/2}).$$
$w$ here is $\exp\big(\frac{2\pi i}{p}\big)$. Is such an estimate known? The fact that the sum in question is $O(p^{9/2})$ follows from using that the second moment is $O(p^{4})$ and the inner sum $O(p^{1/2})$ which uses Weil's work on RH for curves. 
 A: We can actually get an explicit formula for the whole sum (I will assume $p \ne 2,3$ throughout). We start with the Salié sum:
$$\sum_{d=1}^{p-1}\bigg(\frac{d}{p}\bigg)w^{-d-(a^2+b^2+c^2)/d} = \bigg(\sum_d \bigg(\frac{d}{p}\bigg)w^{-d}\bigg) \sum_{x^2 \equiv 4(a^2+b^2+c^2)} w^x.$$
The first factor is a Gauss sum, and has absolute value $\sqrt{p}$, and in fact the exact value is either $\sqrt{p}$ or $-i\sqrt{p}$ depending on whether $p$ is $1$ or $3$ modulo $4$. Write $G$ for this Gauss sum. Then the whole sum becomes
$$G^3\bigg(\sum_{x \not\equiv 0} \sum_{4(a^2+b^2+c^2) \equiv x^2} \frac{1}{2}(w^x + w^{-x})^3 + \sum_{4(a^2+b^2+c^2) \equiv 0} 1\bigg).$$
So we just need to compute the number of ways $N_x$ to write $x^2$ as a sum of three squares, for each $x$. By rescaling, we see that $N_x = N_1$ for $x \not\equiv 0 \pmod{p}$, so the sum becomes
$$G^3(N_0 + N_1\sum_{x \not\equiv 0}\frac{1}{2}(w^{3x} + 3w^x+3w^{-x} + w^{-3x})) = G^3(N_0 - 4N_1).$$
To compute $N_1$, we can use stereographic projection from the point $(1,0,0)$ to the plane $(0,x,y)$, to see that $N_2$ is $p^2$ minus the number of pairs $x,y$ with $x^2+y^2 \equiv -1$, plus the number of pairs $b,c$ with $b^2+c^2 \equiv 0$. Another stereographic projection argument (and the fact that every number is a sum of two squares modulo $p$) shows that there are exactly $p-(\frac{p}{4})$ ways to choose $x,y$ with $x^2+y^2 \equiv -1$. The number of pairs $b,c$ with $b^2+c^2 \equiv 0$ is $p+(p-1)(\frac{p}{4})$. Thus $N_1 = p^2 + p(\frac{p}{4})$.
To compute $N_0$, we can rescale to reduce to counting the number of pairs $x,y$ with $x^2 + y^2 \equiv -1$ (times a factor of $p-1$) or $b^2+c^2 \equiv 0$, and we find that $N_0 = p^2$. Thus the full sum comes out to
$$G^3\bigg(-3p^2-4p\big(\frac{p}{4}\big)\bigg),$$
and the absolute value is $3p^{7/2} \pm 4p^{5/2}$.
