Generalization of inclusion-exclusion rule This is taken from Pollard, A User's Guide to Measure Theoretic Probability problem 1.1.
Let $A_1, A_N$ be events in some probability space. Denote $\cap_{i \in J}A_i$ as $A_J$ for some set $J \subseteq [N]$. Also, denote the sum of the probabilities of the ways that $k$ events occur together as $S_k = \sum_{|J| = k}\mathbb P \{A_J\}$.
Show that the probability of exactly $m$ of the events $A_i$ occurring is given by:
$${m\choose m}S_m - {m+1\choose m} S_{m+1} ... +(-1)^{N-m} {N \choose m} S_N$$
What I've tried
I know that this is a generalization of the inclusion-exclusion rule which gives us the probability that none of the events occur. The inclusion-exclusion rule is easier to derive since it's clear what each term is adding and subtracting. Here I don't have strong intuition on what each of the terms represent.
The binomial coefficients remind me of the stars and bars result: the number of ways to distribute $m$ points into $k$ groups. So the first coefficient is the number of ways to distribute $m$ points into $1$ group, the second is the number of ways to distribute $m$ points into $2$ groups and so on until $N - m +1$ groups. This doesn't seem to be the right interpretation since it does not match up with the $S_k$ terms.
Any hints or intuition would be appreciated.
 A: Let $\mathbb1_B$ be the indicator function of an event $B$, so that $\mathbb1_B$ is a random variable that equals $1$ if the event $B$ occurs and $0$ otherwise; note that the expectation of $\mathbb1_B$ equals the probability that $B$ occurs. Let $E_m$ denote the event that exactly $m$ of the $A_j$ occur. Your desired formula would follow from
$$
\mathbb1_{E_m} = {m\choose m}\sum_{|J| = m}\mathbb 1_{A_J} - {m+1\choose m} \sum_{|J| = m+1} \mathbb1_{A_J} + \cdots + (-1)^{N-m} {N \choose m} \sum_{|J| = N}\mathbb 1_{A_J}
$$
by taking expectations of both sides.
The point is that this equality of functions can be checked separately on every possible combination of the events $A_j$. In particular, if you let $K$ denote the exact set of events that occur, then you can verify that the two sides of the above identity are equal one $K$ at a time. The argument will depend only on $\#K$, and will essentially be "if $\#K = m+k$, then how many terms in the first sum equal $1$, how many terms in the second sum, etc.".
