We know that the sum of first \(a\) natural numbers \(1+2+3+\dots+a\) is given by
$$ \begin{align*} \sum_{n=1}^an&=1+2+3+\dots+a\\ &=\frac{a(a+1)}{2} \end{align*} $$
This Minecraft build contains \(1^2+2^2+3^2+\dots+a^2\) blocks, where in this specific case \(a=6\).
Splitting into layers from right (oak) to left (spruce).
The total number of blocks is the sum of all these layers.
$$ \begin{align*} \sum_{n=1}^an^2&=\left(\sum^a_{n=1}n\right)+\left(\sum^a_{n=1}n-\sum^1_{n=1}n\right)+\left(\sum^a_{n=1}n-\sum^2_{n=1}n\right)+\dots+\left(\sum^a_{n=1}n-\sum^{a}_{n=1}n\right)\\ &=(a+1)\sum^a_{n=1}n-\left(\sum^1_{n=1}n+\sum^2_{n=1}n+\dots+\sum^a_{n=1}n\right)\\ &=(a+1)\frac{a(a+1)}{2}-\sum^a_{n=1}\left(\frac{n(n+1)}{2}\right)\\ &=\frac{a(a+1)(a+1)}{2}-\frac{1}{2}\sum^a_{n=1}\left(n+n^2\right)\\ &=\frac{a(a+1)(a+1)}{2}-\frac{1}{2}\sum^a_{n=1}n-\frac{1}{2}\sum^a_{n=1}n^2\\ \frac{3}{2}\sum^a_{n=1}n^2&=\frac{a(a+1)(a+1)}{2}-\frac{1}{2}\sum^a_{n=1}n\\ 3\sum^a_{n=1}n^2&=\frac{a(a+1)(2a+2)}{2}-\frac{a(a+1)}{2}\\ \sum^a_{n=1}n^2&=\frac{a(a+1)(2a+1)}{6} \end{align*} $$