The sum of a polynomial over a boolean affine subcube Let $P:\mathbb{Z}_2^n\to\mathbb{Z}_2$ be a polynomial of degree $k$ over the boolean cube.
An affine subcube inside $\mathbb{Z}_2^n$ is defined by a basis of $k+1$ linearly independent vectors and an offset in $\mathbb{Z}_2^n$.
[See "Testing Low-Degree Polynomials over GF(2)" by Noga Alon, Tali Kaufman, Michael Krivelevich, Simon Litsyn, Dana Ron - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.9.1235 - for more details]
Why does taking such a subcube and evaluating the sum of $P$ on all $2^{k+1}$ elements of it, always results in zero ?

Let $f(x_1, \ldots, x_n)$ be a binary-valued polynomial in $n$ binary variables, and consider the $2^n$-bit vector
$$[f(0,\ldots, 0, 0), f(0, \ldots, 0, 1), f(0, \ldots, 1, 0), \ldots, f(1, \ldots, 1)]$$
obtained by evaluating $f$ at the $2^n$ vertices of the hypercube.  Does this vector (equivalently the function $f$) have even Hamming weight or odd Hamming weight?  To answer this question, let us expand out $f$ into a sum of minterms by multiplying each monomial by $(x_i + \bar{x}_i)$ for each variable $x_i$ missing in the monomial.  That is, with $n = 4$. say, $x_1x_3$ is expressed as
$x_1(x_2+\bar{x}_2) x_3(x_4 + \bar{x}_4)$ and multiplied out to express it as the sum of $4$ minterms.  Each monomial except $x_1x_2\cdots x_n$ will expand out into an even number of minterms, and thus we have that $f$ has odd Hamming weight if and only if it is of degree $n$  (and therefore contains $x_1x_2\cdots x_n$). Note that $f$ need not contain the minterm $x_1x_2\cdots x_n$:
$$f = \bar{x}_1x_2\cdots x_n = x_1\cdots x_n + x_2\cdots x_n$$
 is of odd weight $1$, has only one minterm (which is not $x_1x_2\cdots x_n$) and 
 is of degree $n$
So, if $f$ is a polynomial of degree $k$ in $n$ variables and $g$ is of degree at most $n-k-1$, then the polynomial $fg$ cannot contain $x_1x_2\cdots x_n$ and must have even weight.  Equivalently, the corresponding $2^n$-bit vectors have inner product $0$, or $f$ and $g$ are orthogonal polynomials, which leads to the notion of duality of Reed-Muller codes.  Finally, if $n = 4$, say, and $f$ is known to be of degree $2$ or less, how can one tell if $f$ contains the term $x_1x_3$?  Well, we test the weight of $x_2x_4f$.  If $x_2x_4f$ is of degree $n$, then the weight is odd.  But if $x_2x_4f$ is of degree $n$ then $f$ must have the term $x_1x_3$ in it.  On the other hand, if the weight of $x_2x_4f$ is even, then $f$ does not contain $x_1x_3$.  Note that evaluating $x_2x_4f$ at $16$ points can be simplified to evaluating $f$ at the four points specified by $x_2 = 1, x_4 = 1$, i.e. an affine subcube.  We could also evaluate $f$ at the four points specified by $x_2 = 1, x_4 = 0$ which corresponds to testing the Hamming weight of $x_2\bar{x}_4f$, and so on.  Thus, if $f$ is of degree
$k$ in $n$ variables, then it is orthogonal to all polynomials of degree at most $n-k-1$, and since a $n - (n - k - 1) = (k+1)$-dimensional affine subcube corresponds to a polynomial of degree $n-k-1$, $f$ has even weight on any $(k+1)$-dimensional affine subcube.
that is, the sum of its values on the subcube is $0$.
