The force of gravity is the only force that keeps a standard hanging pendulum in motion. It is both the force that increases the speed of the pendulum on its downswing and decreases its speed on its upswing. The force of friction from air is the major reason that the arc of the pendulum's swing diminishes over time.
The basic action of a pendulum is a product of its basic structure, gravity and momentum. A true pendulum has a relatively massive weight at the end of a relatively low-mass string or rod that swings freely. When it is moved from its downward resting position and released, it begins to swing back and forth. Gravity is always pulling the weight toward the lowest point in its swing, the resting position. However, because the pendulum must move sideways to reach this point, it builds up momentum in a the sideways direction. Since this momentum is proportional to its mass, just as gravity is, gravity alone is never strong enough to keep it from swinging past the lowest point. Therefore, the pendulum swings past it, and because of its structure, it also moves upward. Gravity eventually stops this motion and begins moving it in the other direction, toward the resting point.