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 ?

The key idea in proving this is restricting a polynomial to an affine subcube. Let $S$ be the subcube
$$
S := \{ z_1 \mathbf v_1 + z_2 \mathbf v_2 + \cdots + z_{k+1} \mathbf v_{k+1} + \mathbf v_0 \,:\, z_i \in \{ 0, 1 \} \text{ for } 1 \leq i \leq k+1 \}
$$
for some fixed vectors $\mathbf v_1, \ldots, \mathbf v_{k+1}$ and $\mathbf v_0$. The restriction of $P$ to $S$ is then defined to be the polynomial $Q : \mathbb Z_2^{k+1} \to \mathbb Z_2$ obtained by formally plugging in $z_1 \mathbf v_1 + z_2 \mathbf v_2 + \cdots + z_{k+1} \mathbf v_{k+1} + \mathbf v_0$ for $\mathbf x$ in $P(\mathbf x)$. That is,
$$
Q(\mathbf z) = P(z_1 \mathbf v_1 + z_2 \mathbf v_2 + \cdots + z_{k+1} \mathbf v_{k+1} + \mathbf v_0), \tag{1}
$$
for all $\mathbf z = (z_1, z_2, \ldots, z_{k+1}) \in \mathbb Z_2^{k+1}$. 
Restrictions are useful because they preserve the degree of the polynomial:

Proposition. If $P$ has degree at most $k$, then so does its restriction $Q$. 

(The proof is simply to expand out $P$ in terms of the indeterminates $z_i$'s, keeping in mind that the $v_i$'s are fixed vectors. Complete the proof as an exercise!)
Now, the sum $\sum_{\mathbf x \in S} P(\mathbf x)$ is the same as the sum $\sum_{\mathbf z \in \mathbb Z_2^{k+1}} Q(\mathbf z)$ where $Q$ is defined as in $(1)$; so it is enough to prove that the latter sum is $0$. 

Lemma. If $Q : \mathbb Z_2^{k+1} \to \mathbb Z_2$ is a polynomial of degree at most $k$, then $$\sum_{\mathbf z \in \mathbb Z_2^{k+1}} Q(\mathbf z) = 0 .$$

First of all, we can assume that the polynomial $Q$ is multilinear without loss of generality. Then since any multilinear polynomial is a linear combination of the basis polynomials $z_T := \prod\limits_{i \in T} z_i$ (where $T \subseteq [n]$), it suffices to prove the lemma for these basis polynomials. The proof is quite easy for the polynomials of the form $z_T$. I recommend that you try it; I will supply hints if you are stuck. 
