How can fossils be used to learn about paleoenvironments?
By a wide variety of mechanisms, but using the concept of "the present is the key to the past" is a starting point.
Fossils can tell us quite a lot about ancient environments by a number of methods, such as:
1) present is the key to the past - if we find bivalve clam fossils in the rock record, we can be fairly sure they lived in an ocean marine environment in the past, because that's were we find them today.
2) related to the above, if we know that a certain species today lives in a salty warm ocean waters and we find that same species as a fossil, we can surmise that the fossil probably lived in a similar salinity temperature regime.
3) plant fossils can provide an estimate of CO2 concentrations in the atmosphere, based on the size of their stomata (little openings under their leaves that let in CO2)
4) fossil teeth tells us quite a lot about what kind of vegetation an animal ate and therefore something about climate - fossil "poop" can also tells us a lot about vegetation at the time.
5) fossil pollens (seeds) tell us a lot about vegetation and hence climate at the time (e.g. dry or wet, warm or cold).