Computing the expected value of the number of runs in a sequence. Suppose we have a sequence of 0's and 1's with $n$ 1's and $m$ 0's, all equally likely. A run is a sequence of only 1's with at least 1 one. What is the expected value for the number of runs?
The number of unique arrangements of the binary digits is given by
$$ N = \frac{(n+m)!}{n!m!} $$
with the probability of the $i^\mathrm{th}$ digit being a 1 given by
$$ \frac{nm}{(n+m)(n+m-1)} $$
How do I approach the solution?
 A: Hint: What is the expected count of how often a 0 is followed by a 1, plus the expected value of the indicator that the first digit in the string is a 1?
Let $X_i$ be the indication that character $i$ in the string is a 1 and character $i-1$ is a 0, with the special case of $X_1$ being simply the event that the first character is a 1.   The probability given in the OP should thus read:
$$\mathsf P(X_i=1)=\begin{cases}\frac{n}{n+m}&:& i=1\\\frac{nm}{(n+m)(n+m−1)}&:& i\in\{2,..,n+m\}\\0&:& \text{otherwise}\end{cases}$$ 
Then the expectation we require is $\mathsf E(\sum_{i=1}^{n+m} X_i)=\sum_{i=1}^{n+m}\mathsf P(X_i=1)$, by the linearity of expectation.

PS: An indicator random variable is a Bernoulli random variable; realising a value of $1$ when the event happens and $0$ other wise.
$$X_i=\begin{cases} 1 & :& i\in\{2,..,n+m\}{\small\text{ and character $i$ in the string is a `1` and character $i-1$ is a `0`}}\\ 1 &:& i=1\text{ and the first character in the string is a `1`}\\0 &:& \text{otherwise}\end{cases}$$
Thus the expected value of an indicator random variable is the probability that the event happens.   $\mathsf E(X_i)=\mathsf P(X_i=1)$
