The layers of rock are known as "strata", and the study of their succession is known as "stratigraphy".
Fundamental to stratigraphy are a set of simple principles, based on elementary geometry, empirical observation of the way these rocks are deposited today, and gravity.
There are situations where it potentially fails -- for example, in cave deposits.
The origins of dating siwon dating
For example, the principle of superposition is based, fundamentally, on gravity.
In order for a layer of material to be deposited, something has to be beneath it to support it.
They are the "initial working hypotheses" to be tested further by data.
Using these principles, it is possible to construct an interpretation of the sequence of events for any geological situation, even on other planets (e.g., a crater impact can cut into an older, pre-existing surface, or craters may overlap, revealing their relative ages).
Many other indicators are commonly present, including ones that can even tell you the angle of the depositional surface at the time ("geopetal structures"), "assuming" that gravity was "down" at the time, which isn't much of an assumption :-).