Question: Given a fair coin, what is the expected number of tosses to get two heads consecutively?
My attempt:
Let $X$ be the number of tosses to get two consecutive heads. Then we are asked to find $$E(X) = \sum_{x=2}^\infty x\cdot P(X=x).$$ Note that $$P(X=x) = \left( \frac{1}{2} \right)^x.$$ So $$E(X) = \sum_{x=2}^\infty x\cdot \left( \frac{1}{2} \right)^x = \left[\sum_{x=1}^\infty x\cdot \left( \frac{1}{2} \right)^x\right] - \frac{1}{2} = 1.5. $$ However, the answer given is $6.$
For $X = 2,$ there is only one possible sequence of flips: HH, probability $\frac14$ as your formula says.
For $X=3$ there is again only one possible sequence: THH, probability $\frac18$ as your formula says.
But for $X=4$ you could have TTHH or HTHH. So $P(X=4)=\frac18,$ not $\frac1{16}$ as implied by your formula.
For $X=5$ the possibilities are TTTHH, THTHH, and HTTHH, probability $\frac{3}{32}.$
For $X=6$ you could have TTTTHH, TTHTHH, THTTHH, HTTTHH, or HTHTHH, probability $\frac{5}{64}.$
After $X=3$ all your probabilities are too small. That is why you get a result much less than the correct result.