How do you calculate the probability when you don't know how many trials will be held? You toss a fair coin until you toss two consecutive heads. Find the probability that you have to toss the coins exactly 4 times.
 A: Pictured below is a tree diagram of the scenario.  We picture leaves on the tree diagram according to where we either win (have head-head on turn three-four) or know that a loss has already or will inevitably occur (head-head on earlier turns or length of sequence will run too long).

The probability of arriving at a specific leaf is the product of the probabilities of traveling along each specific branch.  Considering a fair coin, each branch will be traveled with probability $\frac{1}{2}$.
As a result, the probability of success is $(\frac{1}{2})^4+(\frac{1}{2})^4=\frac{2}{16}=\frac{1}{8}$
Alternatively, notice that success or failure is completely determined by the result of the first four coin-flips.  Two of the sixteen possible ways of flipping four coins will result in a win, while the remaining fourteen result in either a preemptive loss or an inevitable loss.
A: You want the probability that the first four tosses will be $\rm HTH\underline H$ or $\rm TTH\underline H$.   Those are the only outcomes by which the target is met on the fouth toss.
If it is $\rm H\underline HTT, H\underline HTH, H\underline HHT, H\underline HHH, TH\underline HT, TH\underline HH$ you will have met the target before the fourth toss; on the second or third, as indicated.
If it is $\rm TTTT, TTTH, TTHT, THTT, THTH, HTTT, HTHT, HTTH$ then you will not meet the target until somewhen after the fourth toss.   You will certainly eventually met the target, so the exact number of tries required is not important.
Hence the probability of meeting the target on the fourth toss is: $2/16$
