Use Radon's theorem https://en.wikipedia.org/wiki/Radon's_theoremRadon'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 hyperplanesVC-dimension on hyperplanes (which turns out to be tight): https://en.wikipedia.org/wiki/VC_dimension. Then use the Sauer-Shelah lemmaSauer-Shelah lemma to bound the number of behaviors that the hyperplanes can attain on $n$ points https://en.wikipedia.org/wiki/Sauer%E2%80%93Shelah_lemma
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 https://mitpress.mit.edu/books/introduction-computational-learningKearns-theoryVazirani or the paperthis paper by Baum and Haussler http://www.cse.buffalo.edu/~hungngo/classes/2010/711/lectures/0081.pdf to, 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.