"Counting Tricks": using combination to derive a general formula for $1^2 + 2^2 + \cdots + n^2$ I was reading an online article which confused me with the following. To find out $S(n)$, where $S(n) = 1^2 + 2^2 + \cdots + n^2$, one can first write out the first few terms:  

0 1 5 14 30 55 91 140 204 285  

Then, get the differences between adjacent terms until they're all zeroes:  

0 1 5 14 30 55 91 140 204 285
  1 4 9 16 25 36 49 64 81
  3 5 7 9 11 13 15 17
  2 2 2 2 2 2 2
  all zeroes this row

Then it says that therefore we can use the following method to achieve $S(n)$:
$S(n) = 0 {n\choose 0} + 1 {n\choose 1} + 3 {n\choose 2} + 2 {n\choose 3}$.
I don't understand the underlying mechanism. Someone cares to explain?

The underlying mechanism is known as the calculus of finite differences. Just like one can reconstruct a $n$th degree polynomial $f$ from $f(a),f'(a),\ldots,f^{(n)}(a)$, at any point $a$, we can also reconstruct it from $f(a),\Delta_h^1[f](a),\ldots,\Delta_h^n[f](a)$, where 
$$\Delta^n_h[f](x) = 
\sum_{i = 0}^{n} (-1)^i \binom{n}{i} f(x + (n - i) h)$$
is the $n$th forward difference of $f$ at $x$ (we usually take $h=1$). 
It is a common math parlor trick to ask someone to choose a low degree polynomial, ask them its values at $0,1,\ldots,\text{degree}$, and to their amazement tell them their polynomial. We only need to ask them about $\text{degree}+1$ points because we know that the the $\text{degree}+1$'th and higher forward difference of a polynomial will vanish (just like with normal derivatives).
If one suspects that a function is a polynomial, but is unsure of the degree, one can ask for more and more values, and the method of finite differences will return polynomials of higher and higher degree that will approximate the function about $a$ (just like with Taylor series). 
