I've come across this exercise plenty of times and I still don't understand how to do it. (Here it is from N.C. Ex.10.25)
Let $C$ be a linear code (Lets suppose its a binary code, i.e. a $k$-dimensional subspace of $\mathbb{F}_2^n$). Show that $$\sum_{y\in C}(-1)^{x\cdot y} =\begin{cases} |C|\, \text{ if $x\in C^\perp$},\\ 0\, \text{ if $x\notin C^\perp$}.\end{cases}$$
(Aside: This exercise is key in understanding why CSS codes can correct both bit flip and phase flip errors.)
The case where $x\in C^\perp$ is trivial. It's the second case that is less so... I know the following: If $x\notin C^\perp$ then $x\in C$. I can also see that the solution would follow if I could show that half the vectors $y\in C$ were orthogonal to $x$. Since this would imply that the other half are not orthogonal and we would have an equal number of $(+1)$'s coming from $x\cdot y=0$ that would cancel out with the $(-1)$'s from the $x\cdot y=1$ terms. Anyone have the missing piece or am I on the wrong track here.