There are many different kinds of clocks, and they all work differently based on which mechanism they use. All clocks have a source of power, a time base that keeps time, a way to keep track of different amounts of time (hours, minutes or seconds), and a way to display the time.
Pendulum clocks use a wound weight to store potential energy that the clock then uses to run. When you wind the clock, you wind the weight around a drum. A pendulum that swings back and forth in a regular pattern helps to regulate the rate that the second hand moves around the clock. A series of gears inside the clock slow down the rate the barrel turns so that it needs to be wound only occasionally. Within the gears in the clock are specific gears that control how fast the hour and minute hands work.
Atomic clocks have oscillating parts and springs just like pendulum clocks. However, they are powered by the oscillation of electrons of a radioactive element around the nucleus, not by a pendulum.
Digital clocks have all the same components but are run by electricity. There's a time base that keeps time accurately by tracking the rate of electric current entering the clock, a display where the time is shown in numbers instead of with hands, and there's a counting device that allows the display to change accurately.