Typically, if you supply 12 volts to the one wire and ground to the other, the motor spins in one direction. Reverse polarity on the wires & the motor spins in reverse. The switch controls an "H-Bridge" with 4 MOSFETs (or transistors). The switch will trigger the Gates on one high-side and the opposite low-side MOSFET.