On the board we write a series of $n$ numbers, where $n \geq 40$, and each one of them is equal to either $1$ or $-1$, such that the following conditions both hold:

(i) The sum of every $40$ consecutive numbers is equal to $0$.
(ii) The sum of every $42$ consecutive numbers is not equal to $0$.

We denote by $S_n$ the sum of the $n$ numbers of the board. Find the maximum possible value of $S_n$ for all possible values of $n$.
1. **Understanding the sequence and conditions:**
   - We have a sequence of $n$ numbers where $n \geq 40$.
   - Each number in the sequence is either $1$ or $-1$.
   - Condition (i): The sum of every $40$ consecutive numbers is $0$.
   - Condition (ii): The sum of every $42$ consecutive numbers is not $0$.

2. **Analyzing the sequence:**
   - Let the sequence be $a_1, a_2, \ldots, a_n$.
   - From condition (i), we know that for any $i$, the sum $a_i + a_{i+1} + \cdots + a_{i+39} = 0$.
   - This implies that the sequence must have an equal number of $1$s and $-1$s in any block of $40$ numbers.

3. **Periodic nature of the sequence:**
   - Given the sum of every $40$ consecutive numbers is $0$, the sequence must repeat every $40$ numbers.
   - Let the first $40$ numbers be $a_1, a_2, \ldots, a_{40}$.
   - Then $a_{41} = a_1$, $a_{42} = a_2$, and so on.

4. **Constructing the sequence:**
   - To satisfy condition (ii), the sum of any $42$ consecutive numbers must not be $0$.
   - This means that the sequence cannot be perfectly balanced in any block of $42$ numbers.
   - One way to achieve this is to have the first $20$ numbers be $1$ and the next $20$ numbers be $-1$:
     \[
     a_1 = a_2 = \cdots = a_{20} = 1, \quad a_{21} = a_{22} = \cdots = a_{40} = -1
     \]

5. **Calculating the sum $S_n$:**
   - Let $n = 40m + k$ where $m \geq 1$ and $0 \leq k < 40$.
   - The sum of the first $40m$ numbers is $0$ because each block of $40$ numbers sums to $0$.
   - We need to maximize the sum of the first $k$ numbers in the sequence $a_1, a_2, \ldots, a_{40}$.
   - The maximum sum occurs when $k = 20$ (the first $20$ numbers are all $1$).

6. **Conclusion:**
   - The maximum possible value of $S_n$ is $20$.

The final answer is $\boxed{20}$.