The identity is an application of Worpitzky's identity involving Eulerian numbers.
Worpitzky's theorem states:
$$x^n=\sum_{k=0}^{n}A(n,k) \binom{x+k}{n}$$
where Eulerian number $A(n, k)$ is defined to be the number of permutations of the numbers 1 to n in which exactly k elements are greater than the previous element (permutations with k "ascents"). (Worpitzky's identity is not hard to prove using induction btw)
By Worpitzky's identity, for integer $k\geq 1, k^2=\sum_{i=0}^{2} A(2,i) \binom{n+i}{2} = A(2,0)\binom{k}{2}
+A(2,1)\binom{k+1}{2}=\binom{k}{2}+\binom{k+1}{2}$.
So the sum of the squares of the first $n$ positive integers is
\begin{equation}
\begin{aligned}
\sum_{i=1}^{n} k^2 &=\sum_{i=1}^{n} \binom{k}{2} + \sum_{i=1}^{n} \binom{k+1}{2}\\
&= \binom{n+1}{3}+\binom{n+2}{3}\\
&=\frac{1}{6}n(n+1)(2n+1)
\end{aligned}
\end{equation}
This equality follows from the following identity for the rising sum of binomial coefficients:
$$\sum_{j=0}^{n} \binom{j}{m} = \binom{n+1}{m+1}$$
Similarly, we can find the sum of first n cubic numbers. For integer $k\geq 1$, Worpitzky's identity says that $k^3=A(3,0)\binom{k}{3}+A(3,1)\binom{k+1}{3}+A(3,2)\binom{k+2}{3}=\binom{k}{3}+4\binom{k+1}{3}+\binom{k+2}{3}$
Same as we just did in the last case, the sum of the cubes of the first $n$ positive integers is
\begin{equation}
\begin{aligned}
\sum_{i=1}^{n} k^3 &=\sum_{i=1}^{n} \binom{k}{3} + 4\sum_{i=1}^{n} \binom{k+1}{3}+\sum_{i=1}^{n} \binom{k+2}{3}\\
&= \binom{n+1}{4}+4\binom{n+2}{4}+\binom{n+3}{4}\\
&=\frac{1}{4}(n^4+2n^3+n^2)
\end{aligned}
\end{equation}