Proof of the inclusion-exclusion principle
Let me slightly rephrase the argument. Let $N_r$ be the number of elements contained in exactly $r$ of the sets $A_1,\ldots,A_n$. Then the left-hand side is
$$
|A_1 \cup \cdots \cup A_n| = \sum_{r=1}^n N_r.
$$
The first sum on the right-hand side is
$$
\sum_{1 \leq i \leq n} |A_i| = \sum_{r=1}^n \binom{r}{1} N_r.
$$
The second sum on the right-hand side is
$$
\sum_{1 \leq i &lt; j \leq n} |A_i \cap A_j| = \sum_{r=2}^n \binom{r}{2} N_r.
$$
More generally,  the $m$th sum on the right-hand side is
$$
\sum_{1 \leq i_1 &lt; i_2 &lt; \cdots &lt; i_m \leq n} |A_{i_1} \cap A_{i_2} \cap \cdots \cap A_{i_m}| = \sum_{r=m}^n \binom{r}{m} N_r.
$$
Therefore the right-hand side is equal to
$$
\sum_{r=1}^n \binom{r}{1} N_r - \sum_{r=2}^n \binom{r}{2} N_r + \sum_{r=3}^n \binom{r}{3} N_r - \cdots + (-1)^{n+1} \sum_{r=n}^n \binom{r}{n} N_r.
$$
Rearranging, the right-hand side is equal to
$$
\left[ \binom{1}{1} \right] N_1 + \left[ \binom{2}{1} - \binom{2}{2} \right] N_2 + \left[ \binom{3}{1} - \binom{3}{2} + \binom{3}{3} \right] N_3 + \cdots + \\
\left[ \binom{n}{1} - \binom{n}{2} + \binom{n}{3} - \cdots + (-1)^{n+1} \binom{n}{n} \right] N_n.
$$
The coefficient of the general term $N_m$ is
$$
\binom{m}{1} - \binom{m}{2} + \binom{m}{3} - \cdots + (-1)^{m+1} \binom{m}{m}.
$$
By the binomial theorem, this equals $1$, and so the right-hand side equals
$$
1 \cdot N_1 + 1 \cdot N_2 + 1 \cdot N_3 + \cdots + 1 \cdot N_n = \sum_{r=1}^n N_r,
$$
which is exactly the same as the left-hand side.