A quartz clock is a masterpiece of engineering as it uses the sam basic principles that the old pendulum clocks used but takes them to completely new heights and creates a much much smaller thing that can keep accurate time. At the basic level quartz crystal clocks work with the same methodology as regular clocks as they use a oscillating crystal to count seconds and keep that crystal constantly moving by applying force that in this case is an electric current.
To understand how these quartz clocks work we first need to understand the piezoelectric effect that was discovered by Marie and Pierre Currie. This effect shows that when you distort some elements like quartz crystals they can create electric current. But also the opposite effect is true that when you apply an electric current to a crystal it will deform. And if you make that crystal in a precise shape and apply the right amount of electricity you can create a vibrating crystal that can be used in measuring time. If you have ever learned how to play a music instrument you may know what a tuning fork is in that it is a metal object that vibrates at a specific frequency when you hit on it. And exactly the same effect is used with these quartz crystals as they are also shaped like the tuning forks but they are really tiny and they are vibrating at 32769Hz per second and when you divide that number by 60 a couple of time you will get one and that is basically the beginning of one second. Because this crystal oscillates at a certain frequency when a current is applied then you can measure these oscillations and translate them into the motion of a clock hand but because that crystal will stop those vibrations within a couple of seconds you need to constantly jolt that crystal and keep that oscillating frequency constant. Modern Quartz clocks usually are accurate enough to loose only 1 to 5 seconds every month but because the same exact mechanism is also used in atomic clocks you can make timepieces that wont loose a second for millions of years. The basic principle why time is lost is that you can’t tune that quartz crystal the the precise measurement of time as ir will slowly stop oscillating and if you only jolt that crystal ever second then there will be some time lost in between those jolts and that will result in a compounding losses that will ultimately result in a second or two lost here and there.
It is remarkable that we can create a time peace that is precise enough to tell time to such a degree of accuracy in such a small form factor and because of that we can not have clocks that are always righ and that will not loose time and we will always be where we what to be in time!