While looking for some interesting probability problems, I stumbled across Q1 from the 2013 MIT Primes Entrance Exam which asks "[in $n$ coin tosses], what is the probability that the number of heads you’ll get is divisible by 3"? Their official solution (link, pg. 2) claims that the probability $p$ is given by $$ p = 2^{-n} \left(1 + \binom{n}{3} + \binom{n}{6} + \cdots\right) $$.
Where does this formula come from? How might one approach coming up with a formula like this?