Finding the mean time to second failure? So I can find the mean time to failure by using the equation $∑kpk$ which is the expected number of trails. I then used the formula $(1−x)^{−2}=1+2x+3x^2+⋯$ to simplify the above formula to $1/p$ which is the mean time to failure. So what about the mean time to second failure? What I have so far is an example where we want to see the probability of getting two heads:
1/4  HH
1/8  THH
1/16 TTHH
1/32 TTTHH
1/64 TTTTHH

And I don't know where to go from there. I think I know what the answer is but I don't know how to prove it using the above methods. 
 A: If we are counting the number of trials, then notice that the 2nd success occurs on the $k$th trial. Hence, there is one success in the previous $k-1$ trials. there are $\binom{k-1}{1}$ ways to choose where the success happens, there are 2 successes with probability $p = 1/2$, and $k-2$ failures with probability $1-p$. Hence
$$P(X = k) = \binom{k-1}{1}(1-p)^{k-2}p^2.$$
This is a negative binomial distribution. It can be extended to $k$ trials with $r$ successes.
You could approach the way you did to get the mean. Or notice that in thise case,
$$X = X_1+X_2,$$
$X_i$ are the waiting times until the one success. Each is independent and follows a $\text{Geom}(p = 1/2)$ on $\{1,2,3,\dotsc\}$. Thus
$$E[X] = E[X_1] +E[X_2] = \frac{1}{p}+\frac{1}{p} = \frac{2}{1/2} = 4.$$
Second alternative is to use the tail sum formula, since $X$ is non-negative,
$$E[X] = \sum_x P(X\geq x).$$
Note: I treat/define the successes as 'failures' (that you want).
A: Let $X_n\stackrel{\mathsf{iid}}\sim\mathsf{Ber}(p)$. Set $\tau_0=0$ and
$$\tau_m = \inf\{n>\tau_{m-1}:X_n=1\}. $$
Then
\begin{align}
\mathbb P(\tau_1=n) &= \mathbb P\left(\{X_n=1\}\cap\bigcap_{k=1}^{n-1}\{X_k=0\} \right)\\
&= \mathbb P(X_n=1)\mathbb P\left(\bigcap_{k=1}^{n-1}\{X_k=0\} \right)\\
&= p\prod_{k=1}^{n-1}(1-p)\\
&= p(1-p)^{n-1}.
\end{align}
Since the post-$\tau_1$ process $\{X_n: n>\tau_1\}$ is independent of $\{X_n:n\leqslant\tau_1\}$ and has the same distribution $\{X_n:n\geqslant 1\}$, it follows that $\{\tau_m\}$ is a renewal process with interrenewal distribution $\mathsf{Geo}(p)$. The time until the second failure is $\tau_2$; writing $\tau_2=(\tau_2-\tau_1)+\tau_1$ we compute
\begin{align}
\mathbb P(\tau_2 = n) &= \mathbb P((\tau_2-\tau_1)+\tau_1 = n)\\
&= \sum_{k=1}^{n-1}\mathbb P((\tau_2-\tau_1)+\tau_1 = n\mid \tau_1=k)\mathbb P(\tau_1=k)\\
&= \sum_{k=1}^{n-1}\mathbb P((\tau_2-\tau_1=n-k)\mathbb P(\tau_1=k)\\
&= \sum_{k=1}^{n-1} p(1-p)^{n-1-k}p(1-p)^{k-1}\\
&= \sum_{k=1}^{n-1} p^2(1-p)^{n-2}\\
&= (n-1)p^2(1-p)^{n-2},
\end{align}
for $n\geqslant 2$. By induction we can show that $\tau_m$ follows the negative binomial distribution with parameters $m$ and $p$, that is,
$$\mathbb P(\tau_m=n) = \binom{n-1}{n-m}(1-p)^{n-m}p^m,\ n\geqslant m. $$
