Produce Magnet Field
Violet-colored portions are permanent magnets that maintain magnetic force, and are fixed to a motor-housing.
The motor-housing itself produces a magnetic circuit (a magnetic field) with a core (a green-colored portion) and the permanent magnets as a path for the magnetic force to flow.
Current enters the motor from one of the terminals (a portion sticks out forward).
If flows to a winding (an orange-colored portion) via brushes (a brown-colored portion) and a commutator, and goes out of the motor from the other terminal via the brushes and the commutator.
Output by Rotation
The current flows into the magnet field produced by the permanent magnets, and that produces electromagnetic force.
The commutator switches the direction of the current in exact timing to have continuous rotation. The output is pulled out through a shaft.
The shaft can be said to be the exit of mechanical energy. The rings at both ends of the shaft are bearings that support the stable rotation of the shaft.