The amount of ice on Earth changes the distribution of the two stable isotopes of oxygen (oxygen-16 and oxygen-18). Ice at the poles is formed by snow, which came (mostly) from water evaporated from the oceans. Since oxygen-16 is very slightly lighter than oxygen-18 (it has two fewer neutrons per atom), water which contains an oxygen-16 atom is also slightly lighter, and that means it evporates easier. That means clouds (and then snow, and then ice) are rich in oxygen-16, and the ocean water that’s left behind is rich in oxygen-18.
So, the more ice there is on Earth, the richer the ocean is in oxygen-18. But snow isn’t the only thing with oxygen in it: single-celled micro-organisms called foraminifera (forams for short) also make a protective shell out of calcium carbonate (CaCO₃), and they get that oxygen from the ocean water. So, if the ocean water is enriched with oxygen-18 because there’s a lot of ice around, then their shells will also be oxygen-18 rich.
Unlike the ocean water, these shells stick around for millions of years - the forams die and sink to the seafloor, where they get buried and become part of the geological record. Then a geologist comes along, drills into the seabed, and pulls out a long cylinder of mud full of forams, with young ones at the top and ancient ones at the bottom. With expensive mass spectrometers, we can work out the ratio of oxygen-18 to oxygen-16 in their shells, and so how much ice there was on Earth at the time that particular foram was alive.