Let $\big(\frac{n}{p}\big)=-1$ (Legendre's symbol) for an odd prime p. Then show that $$\sum_{d,\ \ d\mid n}\Big(\frac{d}{p}\Big)=0.$$ I know that if $d$ is a divisor of $n$, then $-d$ is also its divisor. Therefore, by properties of Legendre's symbol, we have $$\Big(\frac{-d}{p}\Big)=\Big(\frac{-1}{p}\Big)\times \Big(\frac{d}{p}\Big).$$Since $p$ is an odd prime, we have that $$ \Big(\frac{-1}{p}\Big)=(-1)^{\frac{p-1}{2}}=\pm 1.$$ If $\frac{p-1}{2}$ is odd, then we can prove. How to deduce the result when $\frac{p-1}{2}$ is even.
Is my way of solving correct? Please give hint or solution.
Legendre symbol is a completely multiplicative function whose values are in $\{-1,1,0\}$. Therefore $$\Big(\frac{d}{p}\Big)\Big(\frac{n/d}{p}\Big)=\Big(\frac{n}{p}\Big)=-1\implies\Big(\frac{d}{p}\Big)=-\Big(\frac{n/d}{p}\Big).$$ It follows that $$\sum_{d,\ \ d\mid n}\Big(\frac{d}{p}\Big)=\frac{1}{2}\left(\sum_{d,\ \ d\mid n}\Big(\frac{d}{p}\Big)+\sum_{d,\ \ d\mid n}\Big(\frac{n/d}{p}\Big)\right) =\frac{1}{2}\sum_{d,\ \ d\mid n}\left(\Big(\frac{d}{p}\Big)+\Big(\frac{n/d}{p}\Big)\right)=0$$