An Earthquake is caused by a release of energy from the Earth's crust. This energy can be generated by many different things including dislocation of plates of the crust, manmade explosives and a volcanic erruption. The Earth's crust is split up into many plates which move because of convection currents in the Earth's mantle which are cause by the warm material rising and then cooling and sinking down. The earthquakes that cause most damage are usually caused by dislocation of plates of the Earth's crust.
The crust can sometimes bend and snap because as the Earth's plates on the crust to not have straight edges, the uneven surfaces where two plates meet often crack and break off causing seismic waves which are vibrations. These waves travel outward from the source of the earthquake at varying speeds depending on the material they are travelling through.
A fault is a fracture in the Earth's crust where two plates have slipped towards each other, away from each other or side by side. Earthquakes often reoccur along fault lines because they show where two plates meet and therefore where the weak spots of the crust are.
This is a picture of the San Andreas fault line: