Calculate the whole set
Let S be the set of all possible outcomes.
There are $ 2^4 = 16 $ possible outcomes.
$|S|=16$
Calculat size of event
Let A be the event that we land exactly 2 heads
We can choose 2 spots for the heads out of the 4 spots: $ \binom{4}{2} $
$|A| = \binom{4}{2}$
Profit
$\Pr(A) = \frac{|A|}{|S|}$
$\Pr(A) = \frac{\binom{4}{2}}{16}$