Current flows through the battery, aluminum foil, and paper clips, and into the wire coil, creating an electromagnet. One face of the coil becomes a north pole; the other a south pole. The permanent magnet attracts its opposite pole on the coil and repels its like pole, causing the coil to spin.
Another way to describe the operation of the motor is to say that the permanent magnets exert forces on the electrical currents flowing through the loop of wire. When the loop of wire is in a vertical plane, the forces on the top and bottom wires of the loop will be in opposite directions. These oppositely directed forces produce a twisting force, or torque, on the loop of wire that makes it turn.
Why is it so important to paint half of one projecting wire black? Suppose that the permanent magnets are mounted with their north poles facing upward. The north pole of the permanent magnet will repel the north pole of the loop electromagnet and attract the south pole. But once the south pole of the loop electromagnet is next to the north pole of the permanent magnet, it will stay there. Any push on the loop will merely set it rocking about this equilibrium position.
By painting half of one end black, you prevent current from flowing for half of each spin. The magnetic field of the loop electromagnet is turned off for that half-spin. As the south pole of the loop electromagnet comes closest to the permanent magnet, the paint turns off the electric current. The inertia of the rotating coil carries it through half of a turn, past the insulating paint. When the electric current starts to flow again, the twisting force is in the same direction as it was before. The coil continues to rotate in the same direction.
You can experiment with this device by switching the terminals on the battery, adding a battery, or flipping the magnets. Try adding more magnets, or change the position of the magnets. See what happens!