The first row of the first triangle is 1=12, the second row sums to 2+2=22, the third row sums to 3+3+3=32 and so on. That means that the sum of the numbers in the triangle is 12+22+32+⋯+n2. Now, the second and third triangles are the same, so the left-hand side is 3(12+22+⋯+n2).
On the other hand, each of the numbers in the right-hand side triangle is (2n+1), and there are n(n+1)2 of them.
The picture shows why the two are equal, so we get 3(12+22+⋯+n2)=(2n+1)n(n+1)2, which becomes the formula 12+22+⋯+n2=n(n+1)(2n+1)6.