A commutator is a rotary electric switch that periodically changes the direction of the current between the rotor and the external circuit. In a motor provides energy to the rotor. It consists of a cylinder composed of multiple metal contact segments on the rotor.
the pendulum loses momentum and stops because of gravity and wind resistance. it does not violate the law of conservation of energy because it is not gaining any more momentum than what it had started with