To verify the identity, notenote $\rm\:\sum_{k=1}^n\: k^2 = f(n)\ \iff\ f(n+1) - f(n) = (n+1)^2\:$ and $\rm\: f(1) = 1\:. $ But it's rote polynomial arithmetic to check that the RHS polynomial satisfies this recurrence.
To discover the identity, notice that any polynomial solution of the above recurrence has degree at most $3$. Hence it's easy to find the polynomial solution by substituting a cubic polynomial with undetermined coefficients.
Generally one can give a formulaformula for sums of power using Bernoulli polynomials (motivated by discrete analogs of integrals of powers). The general theory becomes much clearer when one studies finite difference calculus and umbral calculus.