$$ =\sum_{i=1}^{n} \frac{(n-i)(n-i+1)}{2} $$$$ =\sum_{i^{\prime}=0}^{n-1} \frac{i^{\prime}\left(i^{\prime}+1\right)}{2} $$
I see that $i' = n - i$, but shouldn't then the bounds be different? Like for the lower bound $n - 1$ as you substitute in $1$ for $i$ and vice versa?