Error in proving of the formula the sum of squares Given formula
$$
\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}
$$
And I tried to prove it in that way:
$$
\sum_{k=1}^n (k^2)'=2\sum_{k=1}^n k=2(\frac{n(n+1)}{2})=n^2+n
$$
$$
\int (n^2+n)\ \text d n=\frac{n^3}{3}+\frac{n^2}{2}+C
$$
But 
$$
\frac{n^3}{3}+\frac{n^2}{2}+C $$ is not equal to 
$$\frac{n(n+1)(2n+1)}{6}=\frac{n^3}{3}+\frac{n^2}{2}+\frac{n}{6}$$
Where I made a mistake?

Here's an interesting approach using the summation of binomial coefficients.
First, note that 
$$\sum_{i=1}^n {i+a\choose b} = {{n+a+1}\choose {b+1}}$$
and also that
$$i^2=2\cdot \frac{(i+1)i}{1\cdot 2}-i=2{{i+1}\choose 2}-{i\choose 1}$$
Hence
$$\begin{align}
\sum_{i=1}^ni^2 &=\sum_{i=1}^n \left[2{{i+1}\choose 2}-{i\choose 1}\right]\\
&=2 \sum_{i=1}^n {{i+1}\choose 2}- \sum_{i=1}^n {i\choose 1}\\
&=2{{n+2}\choose 3}-{{n+1}\choose 2}\\
&=2\cdot \frac {(n+2)(n+1)n} {1\cdot 2\cdot 3} -\frac {(n+1)n} {1\cdot 2}\\
&=\frac {(n+1)n} 6 \cdot \left[ 2(n+2)-3 \right]\\
&={\frac 16}n(n+1)(2n+1)
\end{align}$$
