Indicators are the mechanism that makes linearity of expectation practical. Worth understanding separately because the setup step is where people go wrong.
Definition
For an event A, the indicator I_A takes the value 1 when A happens and 0 when it does not.
Its expectation is trivially E[I_A] = 1 times P(A) + 0 times P(not A) = P(A).
That equation is the whole idea: expectation of an indicator is a probability.
The pattern
Any quantity of the form "the number of things that happen" can be written as a sum of indicators, one per thing. Then:
E[count] = sum of P(each individual thing happens)
You never need the distribution of the count, which is usually the hard object.
Worked example
n people throw their hats in a pile and each takes one at random. Expected number who get their own hat back?
Let I_k indicate that person k gets their own hat. P(I_k = 1) = 1/n for every k, since by symmetry each person is equally likely to receive any hat.
E[count] = n times 1/n = 1
Independent of n, which is a genuinely surprising and memorable result. With 5 people or 5 million, the expected number of matches is 1.
Setting them up correctly
Two things to get right:
Index over the right objects. For "expected number of adjacent same-colour pairs", index over the 51 gaps, not the 52 cards. Choosing the wrong index set is the most common error.
Get the individual probability by symmetry where possible. Usually each indicator has the same probability, which makes the sum a multiplication.
Variance is different
E[sum] = sum of E always. Var(sum) = sum of Var only if the indicators are uncorrelated, and in most of these problems they are strongly dependent - if person 1 gets their hat, it slightly changes everyone else's chances.
For variance you need covariance terms. Interviewers occasionally ask for the variance in the hat problem precisely to see whether you notice.
Practise in combinatorics and expected value.