Question: For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?

Answer: 
Ice is very important for future missions. Ice is frozen water so if you send some humans there, you can save a lot of weight by using the water already in the area.

Water is H2O. This means that you can split the Hydrogen and oxygen and then converted it into rocket fuel. H would be the fuel and O the oxidiser.

The final thing is that water means that there could be life. Scientists already suspect that there might be bacteria on Europa (a moon of Jupiter). That would have great scientific purposes.
Other answers have discussed water already, so I'll mention other ices.

Life needs enormous quantities of carbon and nitrogen, respectively found in the ices methane and ammonia, plus nitrogen is itself an ice in some environments. In fact, ammonia is even more useful to life than elemental nitrogen, although certain bacteria can convert nitrogen to other compounds. Carbon dioxide, also found as an ice, has [any number of chemical applications](https://en.wikipedia.org/wiki/Carbon_dioxide#Applications) (including production of the [also very useful carbon monoxide](https://en.wikipedia.org/wiki/Carbon_monoxide#Use)), biological or otherwise.

There are also non-biological applications, such as using hydrocarbons to make plastics. These are useful for 3D printing that would be vital to automate the scaling of *in situ* construction. As an added bonus, plastic would provide a lightweight construction option in low-gravity environments.

The ices can even be used as fuel: burning methane in oxygen makes carbon dioxide, which photosynthesis needs as fuel, and burning ammonia in oxygen makes nitrogen (which may be included in artificial Earth-like air) and water. True, this won't be what powers a settlement, partly due to the question of where the oxygen comes from, partly because we'd get far more power from solar, *geo*thermal (in some locations, for want of a better prefix), fission or even fusion one day. But chemical fuels can be convenient in certain contexts. Besides, some ices contain hydrogen, which would be important in a fusion economy.

There are also sulphur-compound ices, such as hydrogen sulphide and sulphur dioxide. Sulphur is another vital element in biology. It may also be useful to trigger a greenhouse effect (e.g. [on Mars](https://en.wikipedia.org/wiki/Terraforming_of_Mars#Use_of_fluorine_compounds), where its compounds are abundant), as sulphur hexafluoride is the most potent known greenhouse gas, plus it's non-toxic at low levels.

In light of the above ideas, the most biologically important element ices *don't* provide is phosphorus.