They don't necessarily have to spin in the same direction, but it gives the best results.
This has to do with the mathematics of drone flight. Pulling from https://drones.stackexchange.com/a/419/46, and in particular the mixing matrix:
ω is the motor speed,
τ is the torque about the axes, and
F is the vertical thrust. Furthermore, the
+/- signs indicate if a motor is spinning clockwise or counterclockwise.)
This mixing matrix is the math that allows us to determine the motor speeds required for the desired movement (roll/pitch/yaw/thrust). Without that, nothing can work-- a quadcopter will fall like a rock without autonomous motor control.
The mixing matrix is subtle in that it tells the tale for the aircraft. For yaw, in particular, we're interested in the z-torque relationship on the third row. If there were other combinations of +/- signs, i.e. you didn't have opposite motors spinning the same direction, then the matrix would either:
lose a special property called invertibility. Without that special property, there are NO possible combinations of motor speeds which can give us an arbitrary combination of roll, pitch, yaw, and thrust.
- What that means is that everything becomes coupled. You can't make the drone yaw right without also accidentally rolling and/or pitching and/or climbing. Not very useful!
make a lopsided control accessibility space, which is a formal way of saying that the copter won't behave symmetrically about the roll, pitch, and yaw axes.
- this isn't ideal, who wants a drone which turns 270 degrees to the left faster than 90 degrees to the right?
We're used to seeing algebraic equations such as
a=b*x, where we can divide by
b to get
a=b*x --> a/b = x.
Unfortunately, with linear algebra (i.e. math with matrices), the "division" by b is not universal. It can only happen if b has a property we call "invertibility", which means that for a system
a = B * x we can only find the solution for
x if we can find
B^-1. In other words,
a * B^-1 = x can only exist if
B^-1 exists. Concretely, without the invertibility, there's no motor speed solution
x which will give us the desired results
A matrix can only be inverted if it's square (rows == columns) AND if the determinant is non-0. The given mixing matrix is the only invertible combination of four props which returns symmetric performance.
Feel free to play around with the matrix on Wolfram Alpha, you'll find that there are other combinations which don't violate invertibility. These are workable and with additional motors and they can even have special desirable properties (see CyPhy Work's LVL 1 hexacopter)