An electric motor works on the principle that a current-carrying conductor in a magnetic field experiences a force. It takes electrical energy as input and produces mechanical energy (rotational motion) as output. This is the opposite of a generator, which converts mechanical energy to electrical energy.