For c≡0modp, #{(x,y)modp:x2+y2≡cmodp} is independent of c and in fact is p−(p−1).
Proof
Observe that #{xmodp:x2≡cmodp}=1+(pc). So using this,
#{(x,y)modp:x2+y2≡cmodp}=a+b≡cmodp(a,b)modp∑#{x2≡amodp}⋅{y2≡bmodp}=a+b≡cmodp∑(1+(pa))⋅(1+(pb))=a+b≡cmodp∑(1+(pa)+(pb)+(pab))=amodp∑(1+(pa)+(pc−a)+(pa(c−a)))=a∑1+a∑(pa)+a∑(pc−a)+a∑(pa(c−a))=a∑1+0+0+a∑(pa(c−a))=p+amodp∑(pa(c−a))→ indep. of c if c≡0modp??=p+amodp∑(pca(c−ca)) change of variables a→camodp for c≡0modp=p+amodp∑(pc2a(1−a))=vp+amodp∑(pc2)(pa(1−a)),c≡0modp=p+amodp∑(pa(1−a))→ indep. of c.
Why is it p−(p−1)?
Let N(c)=#{(x,y)modp:x2+y2≡cmodp},
So N(0)+N(1)+N(2)+…+N(p−1)=p2
Note that N(1),N(2),…,N(p−1) all have same value.
Thus N(0)+(p−1)N(1)=p2⟹N(1)=p−1p2−N(0),N(0)=#{(x,y)modp:x2+y2≡0modp}
Note: x2+y2≡0modp⟹x2≡−y2modp, so if y≡0modp then (xy−1)2≡−1modp.
So if (p−1)=−1 (p≡3mod4) then the only solution to x2+y2≡0modp is (0,0)modp:y≡0⟹x≡0. Then N(1)=p−1p2−1=p+1. ⋆
If (p−1)=1, write −1≡t2modp. Then x2+y2≡0modp⟺x2≡−y2modp⟺x2≡(ty)2modp⟺x≡±tymodp. Therefore, {(x,y):x2+y2≡0modp}={(±ty,y):y∈Z/p}, so (p−1)=1⟹N(0)=1+2(p−1)=2p−1⟹N(1)=p−1p2−(2p−1)=p−1p2−2p+1=p−1(p−1)2=p−1. ⋆
Remark
Knowing #{(x,y):x2+y2≡1modp}=p−(p−1), on LHS, most solutions come in packets of size 8:
(x,y),(−x,y),(x,−y),(−x,−y),(y,x),(−y,x),(y,−x),(−y,−x)modp which are distinct unless x≡0modp, y≡0modp, or x≡ymodp. By counting N(1)mod8 we can derive formula for (p2)→ see Thm 3.1 .