Anything that happens on Earth leaves a record in the rocks: sandstone is the remains of sands that were once sediment in a river or ocean, lava is the remains of past volcanic eruptions, fossils are the remains of once-living things that got buried and preserved. Additionally, there are some simple logical rules as well: if you lay some layer of sediment or rock down from the water, then it will be lying on top of whatever was underneath it, and, therefore, younger sediments will be on top of older sediments.
The predictions come from what we call the "principle of uniformitarianism", which states that the processes acting on the earth in the past are the same as the processes acting on the earth today and are the same as the processes that will act on the earth in the future. This is an assumption that we make, indeed that all science makes, which is that the universe has rules that describe how it behaves. For instance, if we look at the debris from a flood that happened yesterday, and then we look at debris from the past that look the same, we can infer that the previous debris were created in a flood. If we look through the record and see that floods of some scale happen every thousand years or so, then we can predict that they will continue to do so into the future.