Step 1: Set up the problem. In the Wald-Wolfowitz run test, a sequence has \(m\) items of one kind and \(n\) items of another kind, total \(N = m+n\) items. A run is a maximal string of like symbols. Under the null hypothesis of randomness, every arrangement of the \(m\) and \(n\) items is equally likely, and \(R\) is the total number of runs in the sequence.
Step 2: Represent \(R\) using indicator variables. Number the positions \(1, 2, \ldots, N\). For \(i = 1, 2, \ldots, N-1\), let \(I_i = 1\) if the item at position \(i+1\) is of a different type from the item at position \(i\), and \(I_i = 0\) otherwise. Since the first position always starts a run, \[R = 1 + \sum_{i=1}^{N-1} I_i.\]
Step 3: Find \(E(I_i)\). Positions \(i\) and \(i+1\) hold two of the \(N\) items picked without replacement, so \[P(I_i = 1) = \frac{m}{N}\cdot\frac{n}{N-1} + \frac{n}{N}\cdot\frac{m}{N-1} = \frac{2mn}{N(N-1)}.\] This is the same value for every \(i\), by symmetry of a random arrangement.
Step 4: Sum over all \(N-1\) indicators. \[E(R) = 1 + \sum_{i=1}^{N-1} E(I_i) = 1 + (N-1)\cdot\frac{2mn}{N(N-1)} = 1 + \frac{2mn}{N} = \frac{2mn}{m+n} + 1.\]
Step 5: Verify with a small case. Take \(m = n = 2\), \(N = 4\). The \(\binom{4}{2}=6\) equally likely arrangements of two A's and two B's give run counts \(2,4,3,3,4,2\), whose average is \(18/6=3\). The formula gives \(\frac{2(2)(2)}{2+2}+1 = 2+1 = 3\), which matches.
Step 6: Conclusion. \[\boxed{E(R) = \dfrac{2mn}{m+n} + 1}\]