6. Arrange the first $n^{2}$ positive integers $1,2,3, \cdots, n^{2}$ in the following table:
$$
\begin{array}{ccccc}
1 & 2 & 3 & \cdots & n \\
n+1 & n+2 & n+3 & \cdots & 2 n \\
\vdots & \vdots & \vdots & & \vdots \\
(n-1) n+1 & (n-1) n+2 & (n-1) n+3 & \cdots & n^{2}
\end{array}
$$

Now, select a number from the table, and then cross out the row and column containing this number. For the remaining $(n-1)^{2}$ numbers in the table, repeat the above steps, performing a total of $n$ times. The sum of the $n$ numbers taken out equals $\qquad$
6. $\frac{1}{2} n\left(n^{2}+1\right)$.

It is not difficult to see that the element $a_{ij}$ in the $i$-th row and $j$-th column $(i=1,2, \cdots, n ; j=1,2, \cdots, n)$ of the table is $a_{ij}=n(i-1)+j$, which can be set as $n b_{i-1}+c_{j}$. The $n$ numbers taken are from different rows and columns, so $b_{0}, b_{1}, \cdots, b_{n-1} ; c_{1}, c_{2}, \cdots, c_{n}$ each appear exactly once in the representation of these $n$ numbers, which means
$$
\begin{aligned}
S & =\sum_{i=0}^{n-1} n b_{i}+\sum_{j=1}^{n} c_{j}=n(0+1+\cdots+(n-1))+(1+2+\cdots+n) \\
& =\frac{1}{2} n\left(n^{2}+1\right)
\end{aligned}
$$