I've been trying to get this sum: $\sum_{i}^{n} \sum_{j=0}^{n-i}j$ into a closed formula but couldn't really understand how to "unpack" that nested sum.
It occured to me that the answer is: $$\sum_{i=1}^n \left(\sum_{j=0}^{n-i} j\right) = \frac16 n (n^2-1)$$

But I can't figure out why.
From sum of first n natural numbers, we get $$\sum_{i = 1}^{n}\sum_{j = 0}^{n - i}j = \sum_{i = 1}^{n}\frac{(n - i)(n - i + 1)}{2}$$ $$=\frac{1}{2}\sum_{i = 1}^{n}n^2 - (2n + 1)i +i^2+n$$ $$=\frac{n^3}{2} + \frac{n^2}{2} - (2n + 1)\frac{1}{2}\sum_{i = 1}^{n}i + \frac{1}{2}\sum_{i = 1}^{n}i^2$$ Using sum of first n natural numbers and sum of first n squares, we get $$=\frac{n^3}{2} + \frac{n^2}{2} - \frac{n(n+1)(2n + 1)}{4} + \frac{n(n+1)(2n+1)}{12}$$ $$=\frac{n^3}{2} + \frac{n^2}{2} - \frac{n(n+1)(2n + 1)}{6}$$ $$=\frac{n^3}{2} + \frac{n^2}{2} - \frac{2n^3 + 3n^2 + n}{6}$$ $$= \frac{3n^3 + 3n^2 - 2n^3 - 3n^2 - n}{6}$$ $$= \frac{n^3 - n}{6}$$ $$= \frac{n(n^2 - 1)}{6}$$