TITLE: An incorrect method to sum the first $n$ squares which nevertheless works
QUESTION [15 upvotes]: Start with the identity
$\sum_{i=1}^n i^3 = \left( \sum_{i = 1}^n i \right)^2 = \left(\frac{n(n+1)}{2}\right)^2$.
Differentiate the left-most term with respect to $i$ to get
$\frac{d}{di} \sum_{i=1}^n i^3 = 3 \sum_{i = 1}^n i^2$.
Differentiate the right-most term with respect to $n$ to get
$\frac{d}{dn} \left(\frac{n(n+1)}{2}\right)^2 = \frac{1}{2}n(n+1)(2n+1)$.
Equate the derivatives, obtaining
$\sum_{i=1}^n i^2 = \frac{1}{6}n(n+1)(2n+1)$,
which is known to be correct.
Is there any neat reason why this method happens to get lucky and work for this case?

REPLY [5 votes]: This is quite obvious if expressed most naturally in terms of the Bernoulli polynomials, viz.
$\quad\quad\quad\quad\rm\ \ \ \sum n^k\ = \:\frac{1}{k+1} (B_{k+1}(n+1) - B_{k+1}(0))\ $
and $\rm\quad\quad\ B_k^{\:'}(x)\ =\ k\ B_{k-1}(x)\ $ 
thus $\ \rm\ (\sum n^k)'\ =\ k\ \sum n^{k-1} + B_{\:k} $
According to Knuth's exposition these identities go all the way back to Jacobi - with special cases known to Faulhaber. Note that the identities in Robin Chapman's post are simply special cases of these well-known identities for Bernoulli polynomials. 
The Bernoulli polynomials are a special-case of polynomials amenable to study by the powerful techniques of the Umbral Calculus. This is the best way to understand the genesis of their many interesting properties. For a nice introduction see Steven Roman's book.