20.21. The numbers $1,2, \ldots, k^{2}$ are arranged in a square table:

$$
\begin{array}{cccc}
1, & 2, & \ldots, & k \\
k+1, & k+2, & \ldots, & 2 k \\
\ldots & \ldots & \ldots & \ldots \\
(k-1) k+1, & \ldots, & \ldots, & k^{2} .
\end{array}
$$

We will write down an arbitrary number from this table, and then cross out the row and column containing this number. We will do the same with the remaining table of $(k-1)^{2}$ numbers, and so on, $k$ times. Find the sum of the written numbers.
20.21. Answer: $\frac{k\left(k^{2}+1\right)}{2}$.

Let's write the given table as

$$
\begin{array}{cccc}
k \cdot 0+1, & k \cdot 0+2, & \ldots, & k \cdot 0+k \\
k \cdot 1+1, & k \cdot 1+2, & \ldots, & k \cdot 1+k \\
\ldots & \ldots & \ldots & \ldots \\
(k-1) k+1, & (k-1) k+2, & \ldots, & (k-1) k+k
\end{array}
$$

Each number in the table is represented in the form $k a+b$, where $0 \leqslant a \leqslant k-1$ and $1 \leqslant b \leqslant k$. We will separately sum the terms $k a$ and the terms $b$. Since exactly one number is selected from each row, the terms $k a$ will be present for each $a=0,1, \ldots, k-1$. Since exactly one number is selected from each column, the terms $b$ will be present for each $b=1,2, \ldots, k$. Therefore, the desired sum is

$k(0+1+2+\ldots+(k-1))+(1+2+\ldots+k)=k \cdot \frac{k(k-1)}{2}+\frac{k(k+1)}{2}=\frac{k\left(k^{2}+1\right)}{2}$.