Solution (source code)

= Solution

Summing a <geometric series> gives the <probability generating function> of the zero-based <geometric distribution>:
$$
\boxed{G_N(s)=\sum_{j=0}^\infty p(1-p)^js^j=\frac p{1-(1-p)s}.}
$$
The series converges for $|(1-p)s|<1$, in particular on $[0,1]$. At $p=1/2$, $G_N(s)=1/(2-s)$, $G_N'(s)=(2-s)^{-2}$, and $G_N''(s)=2(2-s)^{-3}$. The <factorial moment> identities give $\mathbb E(N)=G_N'(1)=1$ and $\mathbb E[N(N-1)]=G_N''(1)=2$. Thus
$$
\boxed{\mathbb E(N)=1,\qquad\operatorname{Var}(N)=G_N''(1)+G_N'(1)-[G_N'(1)]^2=2.}
$$