Consider the Earth to be a giant recording device. All actions that take place - from continental movement, to volcanic eruptions, to a Triceratops being eaten by a T-Rex, to a man leaving footprints in the mud - can become a part of the earth’s ‘historical’ record at that point in time. Not surprisingly this record can also register climate - from signals as small as a hurricane or as big as a global ice age. This climatic information can be found in unconsolidated sediments (for example, mud at the bottom of a pond), in rocks, in glacial ice sheets, or even in something living like a tree or coral. Each of these systems record something about the world that they developed/grew in.
Climate archives of this sort are often referred to as climate proxies. Consider the need to know the average temperature of the world 10,000 years ago. We can’t just look at a thermometer and record the temperature; we need a substitute, a proxy, that indirectly recorded that information for us. It is our job to find that record and make sense of it. In this way scientists figured out that they could look at an ice sheet in order to get answers about Earth’s climate over the past 400,000 years; or tree rings that record seasonal changes over hundreds and thousands of years; or layered sediments at the bottom of a lake that can indicate severity and length of winter for every year since the lake formed!