In each square of a chessboard with $a$ rows and $b$ columns, a $0$ or $1$ is written satisfying the following conditions.
[list][*]If a row and a column intersect in a square with a $0$, then that row and column have the same number of $0$s.
[*]If a row and a column intersect in a square with a $1$, then that row and column have the same number of $1$s.[/list]
Find all pairs $(a,b)$ for which this is possible.
1. **Initial Setup and Definitions:**
   - Let the chessboard have \(a\) rows and \(b\) columns.
   - Each square contains either a \(0\) or a \(1\).
   - Define \(x\) as the number of \(0\)s in a particular row, and \(b - x\) as the number of \(1\)s in that row.

2. **Conditions for \(0\)s and \(1\)s:**
   - If a row and a column intersect in a square with a \(0\), then that row and column have the same number of \(0\)s.
   - If a row and a column intersect in a square with a \(1\), then that row and column have the same number of \(1\)s.

3. **Analyzing the Number of \(0\)s:**
   - Consider a row with \(x\) \(0\)s.
   - Each column intersecting this row at a \(0\) must also have \(x\) \(0\)s.
   - Each column intersecting this row at a \(1\) must have \(a - x\) \(1\)s, implying \(a - b + x\) \(0\)s.
   - Total number of \(0\)s in the table can be calculated as:
     \[
     x^2 + (b - x)(a - b + x) = ab - b^2 + (2b - a)x
     \]

4. **Case Analysis:**
   - If \(2b - a = 0\), then \(a = 2b\). This is a valid pair. For example, consider two big squares, one filled with \(0\)s and the other with \(1\)s, placed side by side.
   - If \(2b - a \neq 0\), the number of \(0\)s must be consistent across all rows, implying every row has the same number \(x\) of \(0\)s.

5. **Symmetry in Columns:**
   - By similar reasoning, using columns instead of rows, we find that either \(2a - b = 0\) or every column has the same number \(y\) of \(0\)s.
   - If \(2a - b = 0\), then \(b = 2a\), which is another valid pair.

6. **Consistency Across Rows and Columns:**
   - If the board is entirely \(0\)s or \(1\)s, then \(a = b\) is a valid pair.
   - Otherwise, some row and some column intersect at a \(0\), so \(x = y\), and some row and some column intersect at a \(1\), so \(b - x = a - y\), leading to \(a = b\).

7. **Conclusion:**
   - The pairs \((a, b)\) that satisfy the conditions are those where \(a = 2b\), \(b = 2a\), or \(a = b\).

The final answer is \( \boxed{ (a, b) } \) such that \(a = 2b\), \(b = 2a\), or \(a = b\).