Arrange $m$ H's and $n$ T's to have exactly $k$ H-runs In an arrangement of $m$ H's and $n$ T's, an uninterrupted sequence of one kind of symbol is called a run. (For example: HHHTHHTTTH is a sequence of $6$ H's and $4$ T's which opens with an H-run of length $3$, followed by a T-run of length $1$,an H-run of length $2$, a T-run of length $3$ and an H-run of length $1$). Find the number of arrangements of $m$ H's and $n$ T's in which there are exactly $k$ H-runs.
My solution goes like this :

We consider $k$ boxes where we will put $m$ H's. Now, between these boxes we have $k-1$ different boxes where we place only T's. We must place at least one T in all those $k-1$ boxes. If the boxes where H is contained are named as $x_1,x_2,\dots,x_k$, then $x_1+\dots+x_k=m$ and each $x_i\geq 1$. If the boxes where T is contained are named $y_1,y_2,\dots,y_{k-1}$ then $y_1+\dots+y_{k-1}=k-1\space \text{or}\space k\space \text{or}\space k+1,...\text{or}\space n$ and each $y_i\geq 1$. Now, the number of solutions of $x_i$ is $\binom{m-1}{k-1}$. Now, $y_i$ we have different cases and they are all mutually exclusive, so the total number of solutions are $\binom{k-2}{k-2}+\binom{k-1}{k-2}+\dots +\binom{n-1}{k-2}$. Now, the total number of ways to have $k$ H-runs is $\binom{m-1}{k-1}[\binom{k-2}{k-2}+\binom{k-1}{k-2}+\dots+\binom{n-1}{k-2}].$

Is the above solution correct? Is it valid? If not, where is it going wrong? There may be some posts relating to this topic on this site but I can't seem to find it either...
 A: As you observed, the number of $T$-runs is either $k - 1$, $k$, or $k + 1$.  Let's consider cases.
Case 1: $k$ $H$-runs and $k - 1$ $T$-runs.
For this to occur, there must be a run of at least one $T$ in each of the $k - 1$ spaces between runs of at least one $H$.  If $x_i$ is the number of $H$s in the $i$th run, then
$$x_1 + x_2 + \cdots + x_k = m \tag{1}$$
is an equation in the positive integers.  As you found, equation $1$ has
$$\binom{m - 1}{k - 1}$$
solutions in the positive integers.  If $y_j$ is the number of $T$s in the $j$th run, then
$$y_1 + y_2 + \cdots + y_{k - 1} = n \tag{2}$$
is an equation in the positive integers.  The number of solutions of equation $2$ in the positive integers is
$$\binom{n - 1}{k - 2}$$
Hence, there are
$$\binom{m - 1}{k - 1}\binom{n - 1}{k - 2}$$
sequences of $m$ $H$s and $n$ $T$s with $k$ $H$-runs and $k - 1$ $T$-runs.
Case 2: $k$ $H$-runs and $k$ $T$-runs
Runs of at least one $H$ must alternate with runs of at least one $T$.  The number of ways of distributing the $H$s is the number of solutions of equation $1$ in the positive integers, which is
$$\binom{m - 1}{k - 1}$$
The number of ways of distributing the $T$s is the number of solutions of the equation
$$y_1 + y_2 + \cdots + y_k = n \tag{3}$$
in the positive integers.  Equation $3$ has
$$\binom{n - 1}{k - 1}$$
solutions in the positive integers.  Since the first run either begins with an $H$ or with a $T$, the number of sequences of $m$ $H$s and $n$ $T$s which have $k$ $H$-runs and $k$ $T$-runs is
$$\binom{2}{1}\binom{m - 1}{k - 1}\binom{n - 1}{k - 1}$$
Case 3: $k$ $H$-runs and $k + 1$ $T$-runs
For this to occur, there must be a run of at least one $H$ in each of the $k$ spaces between runs of at least one $T$.
The number of ways of distributing the $H$s is the number of solutions of equation $1$ in the positive integers, which is
$$\binom{m - 1}{k - 1}$$
The number of ways of distributing the $T$s is the number of solutions of the equation
$$y_1 + y_2 + \cdots + y_{k + 1} = n \tag{4}$$
in the positive integers.  Equation $4$ has
$$\binom{n - 1}{k}$$
solutions in the positive integers. Hence, the number of sequences of $m$ $H$s  and $n$ $T$s with $k$ runs of $H$s and $k + 1$ runs of $T$s is
$$\binom{m - 1}{k - 1}\binom{n - 1}{k}$$
Total: Since these three cases are mutually exclusive and exhaustive, the number of sequences of $m$ $H$s and $n$ $T$s which have exactly $k$ $H$-runs is
$$\binom{m - 1}{k - 1}\binom{n - 1}{k - 2} + \binom{2}{1}\binom{m - 1}{k - 1}\binom{n - 1}{k - 1} + \binom{m - 1}{k - 1}\binom{n - 1}{k}$$
This expression can be simplified using Pascal's identity.
\begin{align*}
\binom{m - 1}{k - 1}\binom{n - 1}{k - 2} & + \binom{2}{1}\binom{m - 1}{k - 1}\binom{n - 1}{k - 1} + \binom{m - 1}{k - 1}\binom{n - 1}{k}\\
& \qquad = \binom{m - 1}{k - 1}\left[\binom{n - 1}{k - 2} + 2\binom{n - 1}{k - 1} + \binom{n - 1}{k}\right]\\
& \qquad = \binom{m - 1}{k - 1}\left[\binom{n - 1}{k - 2} + \binom{n - 1}{k - 1} + \binom{n - 1}{k - 1} + \binom{n - 1}{k}\right]\\
& \qquad = \binom{m - 1}{k - 1}\left[\binom{n}{k - 1} + \binom{n}{k}\right]\\
& \qquad = \binom{m - 1}{k - 1}\binom{n + 1}{k}
\end{align*}
Addendum:  In the comments, you suggested the formula
$$\binom{m - 1}{n - 1}\sum_{a = k - 1}^{n} \binom{a - 1}{k - 2}\binom{n - a + 1}{1}$$
where the term in front of the summation is the number of ways of distributing the $m$ $H$s into $k$ runs, the term $\binom{a - 1}{k - 2}$ is the number of ways of distributing $a$ $T$s to the $k - 1$ runs of tails between successive runs of heads, and $\binom{n - a + 1}{1}$ is the number of ways of distributing the remaining $n - a$ $H$s to the spaces before the first $H$ or after the last $H$ without restriction.
Each of these formulas is correct.  The first term was discussed above.  The number of ways of distributing $a$ $T$s to $k - 1$ runs is the number of solutions in the positive integers of the equation
$$y_1 + y_2 + \cdots + y_{k - 1} = a$$
which is
$$\binom{a - 1}{k - 2}$$
The number of ways of distributing the remaining $n - a$ heads to the spaces to the left of the first head or to the right of the last head without restriction is the number of solutions of the equation
$$y_0 + y_k = n - a$$
in the nonnegative integers, which is
$$\binom{n - a + 2 - 1}{2 - 1} = \binom{n - a + 1}{1}$$
Observe that
$$\sum_{a = k - 1}^{n} \binom{a - 1}{k - 2}\binom{n - a + 1}{1}$$
is the number of ways of selecting $k$ elements from the $(n + 1)$-element set $\{0, 1, 2, \ldots, a - 1, a, \ldots, n\}$, where we select $k - 2$ elements which are less than $a - 1$, select $a - 1$, and then select one of the $n - (a - 1) = n - a + 1$ elements larger than $a$, where $a$ can vary from $k - 1$ to $n$. Hence,
$$\binom{m - 1}{n - 1}\sum_{a = k - 1}^{n} \binom{a - 1}{k - 2}\binom{n - a + 1}{1} = \binom{m - 1}{n - 1}\binom{n}{k + 1}$$
as required.  Therefore, the formula you wrote in the comments is correct.
That said, the answer I wrote above is easier to work with since there are fewer terms and is easier to simplify since the simplifications rely on Pascal's identity rather than a pivot point.
