In the case of the ocean limestones, it tends to be chock-full of marine fossils. They die. They sink. Other stuff falls on top. More stuff falls on top of that.
Maybe eventually conditions change and deposition stops. What was sea bottom is lifted up so that surf and tides wear on it. Some of the sediment wears away, but maybe not all. Maybe it eventually becomes tidal swamp, with a different kind of deposition layered over what was the bottom half of the original limestone layer.
What tends to happen is that any given slice of geography has periods of deposition. There's missing data between the layers. This happens because just locally erosion predominated for a time. (But you can fill in the picture by moving around and sampling lots of places around the area. You compare and correlate. Dig A might show a layer between layers which are successive in Dig B simply because there was less erosion at the site of Dig A.
This is elementary geology. Shame they didn't cover it in a college-level intro course.