Let's start by the interior summation, which is $$ \sum_{i=0}^{k-2} 1=\underbrace{1+1+\cdots +1}_{k-1\, \text{times}}, $$ k-1 times because there are the term when $i=0, i=1,\ldots , i=k-1$. So know you have $$ 2\sum_{k=1}^{n}(k-1) $$
Take $j=k-1$. When $k=1,j=0$ and when $k=n,j=n-1$, yielding $$ 2\sum_{j=0}^{n-1}j $$
Note that the $j=0$ term is useless, so you could always take it out, and you can explicitly calculate this sum with this formula: $$ \sum_{j=1}^n j= \frac{n(n+1)}{2}. $$ In your case, one gets $$ 2\sum_{j=0}^{n-1}j=\frac{2(n-1)n}{2}=n(n-1) $$