Sum of First $n$ Squares Equals $\frac{n(n+1)(2n+1)}{6}$ I am just starting into calculus and I have a question about the following statement I encountered while learning about definite integrals:
$$\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}$$
I really have no idea why this statement is true. Can someone please explain why this is true and if possible show how to arrive at one given the other?

Late to the party, but I hope I am contributing something new to the answers already posted here.
We seek
$$\sum_{i=1}^Ni^2=1^2+2^2+\cdots+N^2$$
which, geometrically speaking, is equivalent to adding the area of $N$ squares with side lengths $1,2,...,N$. A visual depiction when $N=2$ is
                                                           
By adding the missing tile on the top-left corner, we may form a rectangle as follows,
                                                           
with area $2(1+2)$. Then our sum, for $N=2$, is
$$S_2=1^2+2^2=\text{Area rectangle}-\text{Area tile} = 2(1+2)-(1\cdot1).$$
To get a better idea, consider the case with $N=3$,
                             
and again, adding the missing tiles so that we form a rectangle, gives
                             
with area $3(1+2+3)$. The desired sum, for $N=3$, is
$$S_3=1^2+2^2+3^3=\text{Area rectangle}-\text{Area tiles} = 3(1+2+3)-[\underbrace{1\cdot1}_\text{blue tile}+\underbrace{1\cdot(1+2)}_\text{red tile}].$$
Drawing a few more, one may notice that the height of each tile is $1$ and the base is the sum of the bases of the previous squares. In general, we have
$$
\begin{aligned}
S_N = \sum_{i=1}^Ni^2&=N\left(\sum_{i=1}^Ni\right)-\left[1\cdot1+1\cdot(1+2)+\cdots+1\cdot(1+2+\cdots+N-1)\right]\\
& =N\left(\sum_{i=1}^Ni\right)-\sum_{i=1}^{N-1}\sum_{j=1}^{i}j=N\left(\frac{N(N+1)}{2}\right)-\sum_{i=1}^{N-1}\frac{i(i+1)}{2}\\
&=\frac{N^2(N+1)}{2}-\frac12\sum_{i=1}^{N-1}i^2-\frac12\sum_{i=1}^{N-1}i=\frac{N^2(N+1)}{2}-\frac12\sum_{i=1}^{N-1}i^2-\frac{(N-1)N}{4}\\
&=\frac{N^2(N+1)}{2}-\frac12\sum_{i=1}^{\color{red}{N}}i^2+\frac{N^2}2-\frac{(N-1)N}{4},
\end{aligned}$$
and now solving for $\sum i^2$ leads to
$$\frac32\sum_{i=1}^Ni^2=\frac{N^2(N+1)}{2}+\frac{N^2}2-\frac{(N-1)N}{4}\implies\sum_{i=1}^Ni^2=\frac{N(2N+1)(N+1)}{6}.$$
