How many HH pairs appear in a 100-coin toss sequence? What is the expected number of 2-consecutive-head pairs in a sequence of 100 fair coin flips, allowing overlap (HHH equals two pairs)?
 A: Consider the independent random variables $X_1,X_2,\dots, X_N$, where $N=100$ for short, taking the values $0,1$ with equal probability. We consider here an H to be one, a T to be zero. Then we need the mean (or expectation, expected value $\Bbb E$) of the variable $X_1X_2+X_2X_3+\dots+X_{N-1}X_N$, which is:
$$
\begin{aligned}
&\Bbb E[\ X_1X_2+X_2X_3+\dots+X_{N-1}X_N\ ]\\
&\qquad =\Bbb E[X_1X_2] + \Bbb E[X_2X_3]+\dots+\Bbb E[X_{N-1}X_N ]\\
&\qquad =\Bbb E[X_1]\;\Bbb E[X_2] + \Bbb E[X_2]\; \Bbb E[X_3]+\dots+\Bbb E[X_{N-1}]\; \Bbb E[X_N ]\\
&\qquad =\underbrace{\frac 12\cdot\frac 12 + \frac 12\cdot\frac 12+\dots+\frac 12\cdot\frac 12
}_{(N-1)\text{ times}}\\
&\qquad =\frac 14(N-1)\ .
\end{aligned}
$$
A: Quick estimate. Think of the sequence as wrapping around (makes the calculation easier). Then there are $100$ pairs. Each has a $25\%$ chance of being HH. So you expect $25$ such pairs.
Another way to look at it: each of the expected $50$ heads is equally likely to be followed by a head or a tail.
A: Let $Y_i=1$  if $X_i=X_{i+1}=H$ , $Y_i=0$ elsewhere. We have $E[Y_i]=P(Y_i=1)=\frac14$.  
Further, the number of HH pairs is  $T=\sum_{i=1}^{N-1} Y_i$ and 
$$E[T]=  \sum_{i=1}^{N-1} E[Y_i]=(N-1) \frac14$$
