The earthquakes are a direct result of the plate tectonics. In order for an earthquake to appear, there should be a geologic activity caused by the movement of the tectonic plates. The movement of the tectonic plates causes a lot of pressure on the rocks. The rocks eventually break at certain places under the pressure. A they break, there's movement bellow the surface, or rather inside the crust, also referred to as adjustment. That movement and the release of power from it, causes lot of strong vibrations. The vibrations spread out and start shaking the ground in the surrounding area, which is actually the earthquake itself.
A wave will travel only as long as it has energy to carry. The energy makes a wave travel and it will stop traveling as soon as the energy is dissipated.