A motor controller "is a device or group of devices that serves to govern in some predetermined manner the performance of an electric motor. A motor controller might include a manual or automatic means for starting and stopping the motor, selecting forward or reverse rotation, selecting and regulating the speed, regulating or limiting the torque, and protecting against overloads and faults."
The controller sits between a battery pack and an electric motor, and it governs the amount of power sent to the motor. There is usually a throttle of some sort connected to the controller, the throttle is used by the operator to tell the controller what to do.
The Alltrax Document Depot contains some wiring diagrams of using an Alltrax controller in a vehicle. These are also somewhat applicable to other controllers, however details will differ.
A controller must be matched with the type of motor it is controlling because each motor type requires different power and control connections.
Electronic speed control: "An electronic speed control or ESC is a device mounted onboard an electrically powered radio control model in order to vary its drive motor's speed, its direction and even to act as a dynamic brake in certain controllers. An ESC can be a stand-alone unit which plugs into the receiver's throttle control channel or incorporated into the receiver itself, as is the case in most toy-grade R/C vehicles. Some R/C manufacturers that install proprietary hobby-grade electronics in their entry-level vehicles, vessels or aircraft use onboard electronics that combine the two on a single circuit board."
Controllers for Electric Motors: A Treatise on the Modern Industrial A book published in 1919 about electric motor controllers.