Use Radon's theorem to show that homogeneous hyperplanes $w$ can shatter (i.e., assign all possible sign sequences via $x\mapsto\text{sign}(<w,x>)$ at most $d$ points. This is an upper bound on the VC-dimension on hyperplanes (which turns out to be tight). Then use the Sauer-Shelah lemma to bound the number of behaviors that the hyperplanes can attain on $n$ points
That accounts for the formula $\sum_{i=1}^d {n\choose i}$.
As for pairs of hyperplanes, I'll use a very crude bound for VC-dimension of intersections of pairs of sets from a VC-class of dimension $d$, see Theorem 3.6 in Kearns-Vazirani or this paper by Baum and Haussler, to get that the VC-dimension of the collection of pairs of hyperplanes in $d$ dimensions is at most $20d$. You can then apply Sauer-Shelah to this new value of VC-dimension.