The earth has four major layers: the inner core, outer core, mantle and crust.  The crust is what we need to think about here and the earth's crust is divided into 'plates' that are like puzzle pieces but are up to 50 miles thick and they are in constant motion in the earth's interior.   These puzzle pieces are tectonic plates and the edges of the plates are called the plate boundaries. The plate boundaries are made up of many faults, and most of the earthquakes around the world occur on these faults.  Most earthquakes are due to pressure that builds up over time and that pressure causes the ground to 'slip' along a geological fault plane on or near a plate boundary. The vibrations that occur when that slip happens create ground motion at the surface that vibrates

Here are some terms to understand.

Focus/Hypocenter - The point where the fault first slips.
Epicenter - a theoretical point on the earth's surface directly above the focus.
Fault - a fracture across which slippage (or displacement) has occurred during an earthquake, which may be less than an inch or more than 10 yards in a severe earthquake.
Magnitude - the energy released during an earthquake, computed from the amplitude of the seismic waves.   We commonly call it the Richter Scale and each whole number on the scale represents an increase of about 30 times more energy released than the previous whole number represents. Therefore, an earthquake measuring 6.0 is about 30 times more powerful than one measuring 5.0.
Aftershock - an earthquake of lesser intensity that follows the main earthquake.

How do scientists measure magnitude?   In the easiest way imaginable - a simple device called a seismograph.    A seismograph has a base in the ground and a heavy weight that hangs free. When an earthquake causes the ground to shake, the base of the seismograph shakes too, but the hanging weight does not. Instead the spring or string that it hangs from absorbs all the movement and the difference in position between the shaking part of the seismograph and the motionless part is what is recorded.

A short wiggly line means a small earthquake and a long wiggly line that wiggles a lot means a large earthquake. The length of the wiggle depends on the size of the fault, and the size of the wiggle depends on the amount of slip.

Lots of things can cause an earthquake that is not natural at all.   Underground nuclear bomb testing restrictions are easy to enforce, for example, because a nuclear bomb produces seismic waves that can easily be detected, like any large earthquake.

Dr. Pat Abbott explains an earthquake in action: