The basic purpose of commutation is to ensure that the torque acting on the armature is always in the same direction, the voltage generated in the armature is essentially alternating, and the commutator converts it to direct current; in short, the commutator Turn the coil on and off to control the direction in which the electromagnetic field is pointing. On one side of the coil, the current should always "flow away". On the other hand, the current should always flow "toward", which ensures that the torque is always generated in the same direction; otherwise, the coil will rotate 180 degrees in one direction, then Switch direction.
The commutator itself is a split ring, usually made of copper, with each part of the ring connected to each end of the armature coil. If the armature has multiple coils, the commutator will also have multiple segments - one for each end of each coil. Spring loaded brushes are located on either side of the commutator and are in contact with the commutator as the commutator rotates, providing voltage to the commutator segments and the corresponding armature coils.
When the brush passes through the gap in the commutator, the supplied charge switches the commutator segment, and the commutator segment switches the polarity of the armature coil. This switching of the coil polarity maintains the rotation of the armature in one direction. The voltage between the brushes fluctuates between zero and maximum, but always maintains the same polarity.