We write on the board the numbers $1, \frac{1}{2}, \ldots, \frac{1}{n}$. An operation consists of erasing two numbers, say $a$ and $b$, and writing $a+b+a b$. What number remains after $n-1$ operations?
We notice that $a+b+a b=(a+1)(b+1)-1$. If the numbers written on the board at a certain stage are $a_{1}, \ldots, a_{n}$, this suggests considering the product $\left(a_{1}+1\right) \ldots\left(a_{k}+1\right)$, which will be invariant from one operation to another. At the beginning, it is

$$
(1+1)\left(\frac{1}{2}+1\right) \ldots\left(\frac{1}{n}+1\right)=\prod_{i=1}^{n} \frac{i+1}{i}=n+1
$$

the last equality being obtained by telescoping. Therefore, the remaining number is $n$.