We can find the answer to be:
$$\vec{\omega}_b = \frac{\omega_b^2}{\omega_a}$$
where $\vec\omega_b$ is the average angular velocity (a vector), and $\omega_a$ and $\omega_b$ are the runner's speeds (scalars).
Imagine the runners on a circular track that, for simplicity's sake, is the unit circle. As a starting point, place the runners opposite from one another as if they've just had their second alignment, so they're both moving CCW.
It's clear that to realign, runner A will have to overtake B, then keep going to a point opposite from B. Specifically, A must move by an angle of $\tau + x$ while B moves by an angle of $x$--A moves exactly a full circle farther. A will pass B at angle $x/2$ CCW from B's starting position.
To simplify a bit, let $\omega_a = k\omega_b$. (Hence $k>1$.) Then taking these together, it's clear that when they next align, we will have:
$$\tau + x = kx \implies x=\tau/(k-1)$$
Note that the angle $x$ traveled by B will be the same no matter where on the track the runners are when they're aligned. We didn't specify a starting point because we didn't need to. And this solution passes a common sense test: if $k=2$, so A is twice as fast as B, we get $x=\tau$; B makes a full circle, while A runs two laps. Visualize it or draw it out to convince yourself of how it works.
Once they've aligned, B instantly turns around. This time B must move by an angle of $-y$ while A moves by $\tau -y$; that means this angle (and the time taken) will be shorter. Hence by the prior algebra we have
$$\tau - y = -ky \implies y = -\tau/(k+1)$$
And again, common sense test: for $k=2$, B will move by $-\tau/3$, one-third of the circle, while A moves $2\tau/3$ in the opposite direction. If B started at angle $0$, then B has moved to $2\tau/3$, and A has moved to $\tau/6$ (starting from $\tau/2$ and passing go $0$).
This means that every two alignments, B will move an angle (angular displacement) of
$$\vec{\theta} = x+y = \frac{\tau}{k-1} - \frac{\tau}{k+1} = \frac{2\tau}{k^2 -1}$$
But note their total angular distance traveled is the difference rather than the sum (as we made $y$ negative to begin with). So the total angular distance (scalar) is
$$\theta = x-y = \frac{2k\tau}{k^2-1}$$
How far does A move? We weren't asked, so we won't bother! However, we were asked for an average velocity, and we've found... an angle. Two angles, actually. But here's the cool thing: our angle is independent of the velocities; it depends only on k, their ratio. And runner B will traverse this angle (which, remember, includes both the forward and backward part) in a certain time related to their speed. That time is $t=\theta / \omega_b$. But $\vec{\omega}_b = \vec\theta /t$, hence
$$\vec\omega_b = \omega_b \cdot \frac{\vec\theta}{\theta} = \omega_b \frac{2\tau}{2k\tau} = \frac{\omega_b}{k} = \frac{\omega_b^2}{\omega_a}$$
Hopefully this helps you!
That said, it really shouldn't be tagged number-theory or modular-arithmetic, so I'll edit your tags a bit.