Probability of getting a sequence of at least $k$ heads in $n$ coin flips. Let's say we are flipping a coin $n$ times. What is the probability of getting a sequence of at least $k$ heads?
So far I've come up with this:
If we assume $k=2$, and the number of events satisfying the conditions is $m$ for $N$ throws, then for $N+1$ throws the number of satisfying events is: $2m + \frac{2^N - m}{2}$.
$2m$ comes from the situation when the sequence was already there so we can get either heads or tails.$\frac{2^N - m}{2}$ Is when there was no sequence but the last result was heads, so we have to get heads again. This can be made into an equation and solved, I guess.
However, it's more difficult to do it for higher $k$. How to proceed further to get a result for higher $k$?
 A: This is not a complete answer to your question but only works under the extra condition that $n\leq2k$.
Flip a fair coin again and again (so do not stop).
Let $A_{k,n}$ denote the event that among the first $n$ tosses there is a consecutive sequence of at least $k$ heads.
Let $T$ denote the index of the first occurence of a tail (so e.g. $T=4$ iff the sequence starts with $HHHT$).
Then $P(T=t)=2^{-t}$.
We find that $P(A_{k,n}\mid T=t)=1$ if $t>k$ and $P(A_{k,n}\mid T=t)=P(A_{k,n-t})$ otherwise.
Based on that we find:$$P(A_{k,n})=\sum_{t=1}^{\infty}P(A_{k,n}\mid T=t)P(T=t)=\sum_{t=1}^kP(A_{k,n-t})2^{-t}+\sum_{t=k+1}^{\infty}2^{-t}=\sum_{t=1}^kP(A_{k,n-t})2^{-t}+2^{-k}$$where $A_{k,n-t}=\varnothing$ and consequently $P(A_{k,n-t})=0$ if $k>n-t$.
Based on this equality by induction it can be proved that:

$$P(A_{k,n})=2^{-k}\left(\frac12n-\frac12k+1\right)\text{ for }n\in\{k,k+1,\dots,2k\}\tag1$$

As base case we have $P(A_{k,k})=2^{-k}$ by substitution $n=k$ and it is evident that this is correct.
Presupposing that the equality holds for every $n\in\{k,k+1,\dots,m-1\}$ where $k<m\leq2k$ we find:$$P(A_{k,m})=\sum_{t=1}^kP(A_{k,m-t})2^{-t}+2^{-k}=\sum_{t=1}^{m-k}P(A_{k,m-t})2^{-t}+2^{-k}=\sum_{n=k}^{m-1}P(A_{k,n})2^{n-m}+2^{-k}=$$$$2^{-k}\sum_{n=k}^{m-1}\left(\frac12n-\frac12k+1\right)2^{n-m}+2^{-k}=2^{-k}\left(\frac12m-\frac12k+1\right)$$

If the coin is unfair and there is a probability of $p$ on heads and $q=1-p$ on tails then the same route can be followed to arrive at the more general formula:

$$P\left(A_{k,n}\right)=p^{k}\left(\left(n-k\right)q+1\right)\text{ for }n\in\{k,k+1,\dots,2k\}$$

Also see this question.
