A combinatorial proof:
Let $S=\{1,2,\dots,(n+1)\},n\ge 2$ and $T=\{(x,y,z)|x.y,z\in S,x< z,y< z\}$.By counting the number of members of $T$ in $2$ different ways I will prove the formula.
$1$st way:
We will at first Choose $z$ form the set $S$.When $z$ is $1$ then there are no choices for $x,y$ so the no. of elements of $T$ with $z=0$ is zero.When $z=2$ the number of choices for $x$ is $1$ and so is for $y$(precisely $x=y=1$).When $z=3$ then $x\in \{1,2\}$ and $y\in \{1,2\}$ so total no. of choices equals $2^2$.In a similar manner when $z=k,(1\le k\le (n+1))$,no. of choices for $x$ equals $(k-1)$ and no. of choices for $y$ is also $(k-1)$. So total no . of elements of T with $z=k$ is $(k-1)^2$.
So we will get the total no. of elements of $T$ by summing $(k-1)^2$ up from $1 $ to $(n+1)$.Hence $|T|=\sum _{l=1}^{(n+1)}(l-1)^2=\sum_{k=1}^{n}k^2$
$2$nd way:
Among the elements of $T$ consisting of three numbers from the set $S$, there are elements in $x=y$ and elements in which $x\ne y$.
We can count the no. of elements in which $x=y$ by choosing two distinct nos. from $S$ and assigning $z$ with the lagest no. and $x,y$ with the smallest number. We can choose two distinct numbers from $S$ in $\displaystyle \binom{n+1}{2}$ ways, so the total no. elements having $x=y$ is $\displaystyle \binom{n+1}{2}$.
Now we have to count the number of elements in which $x\ne y$.This means that $x,y$ are dinstict and as they are less than $z$ this means that all the three are distinct. So we can count no. of such elements in $T$ in the following way.At first we will choose three elements from the set $S$ and assign the largest value to $z$ and assign the other two values to $x,y$. Now we can choose three numbers from the set $S$ in $\displaystyle \binom{n+1}{3}$.From each such three element we can get two elements of the set $T$(Assigning the largest to $z$ and then assigning any one of then to $x$ and the other to $y$). So no. of elements of $T$ having $x\ne y$ is $2\displaystyle \binom{n+1}{3}$
So by this method we have $|T|=\displaystyle \binom{n+1}{2}+2\displaystyle \binom{n+1}{3}$
On equating the result obtained from both the methods we have $\sum_{k=1}^{n}k^2=\displaystyle \binom{n+1}{2}+2\displaystyle \binom{n+1}{3}=\frac{n(n+1)(2n+1)}{6}$
Note that this can easily be extended to find the sum of $p$th power of integers.($p\in \mathbb{N})$