Write either $1$ or $-1$ in each of the cells of a $(2n) \times (2n)$-table, in such a way that there are exactly $2n^2$ entries of each kind. Let the minimum of the absolute values of all row sums and all column sums be $M$. Determine the largest possible value of $M$.
1. **Problem Restatement**: We need to fill a \( (2n) \times (2n) \) table with entries of either \( 1 \) or \( -1 \) such that there are exactly \( 2n^2 \) entries of each kind. We are to determine the largest possible value of \( M \), where \( M \) is the minimum of the absolute values of all row sums and all column sums.

2. **Sum of Entries**: Since there are \( 2n^2 \) entries of \( 1 \) and \( 2n^2 \) entries of \( -1 \), the total sum of all entries in the table is:
   \[
   \sum_{i=1}^{2n} \sum_{j=1}^{2n} a_{ij} = 2n^2 \cdot 1 + 2n^2 \cdot (-1) = 0
   \]

3. **Row and Column Sums**: Let \( r_i \) be the sum of the entries in the \( i \)-th row and \( c_j \) be the sum of the entries in the \( j \)-th column. We need to find the configuration that maximizes the minimum absolute value of these sums.

4. **Sum of Absolute Values**: Consider the sum of the absolute values of all row sums and all column sums:
   \[
   \sum_{i=1}^{2n} |r_i| + \sum_{j=1}^{2n} |c_j|
   \]
   Since the total sum of all entries is zero, the sum of the row sums and the sum of the column sums must also be zero:
   \[
   \sum_{i=1}^{2n} r_i = 0 \quad \text{and} \quad \sum_{j=1}^{2n} c_j = 0
   \]

5. **Balancing the Sums**: To maximize \( M \), we need to balance the row and column sums as evenly as possible. The best configuration is when each row and each column has the same absolute sum. Given the constraints, the optimal configuration is when each row and each column sum is either \( 2 \) or \( -2 \).

6. **Constructing the Table**: One way to achieve this is to arrange the entries such that each row and each column has exactly \( n+1 \) entries of \( 1 \) and \( n-1 \) entries of \( -1 \), or vice versa. This ensures that the sum of each row and each column is \( \pm 2 \).

7. **Verification**: If each row and each column has a sum of \( \pm 2 \), then the minimum absolute value of the row sums and column sums is \( 2 \). This configuration satisfies the requirement of having exactly \( 2n^2 \) entries of each kind.

Conclusion:
The largest possible value of \( M \) is \( 2 \).

The final answer is \(\boxed{2}\).