The easiest way to tell if a planet has water on it is through spectral data. By splitting the light into its component wavelengths, you can identify the composition of an object's surface. This can be done fairly easily by Earth-based telescopes. However, this has two major downsides: it can only identify what's on the surface and it can only analyze the spectrum of wide swaths of planet.
In the most recent discovery of water on Mars, done by the Mars Express probe, the instrument which made the discovery was MARSIS, a low-frequency radar device. It used radar to penetrate through the surface and look for subsurface features. Liquid water is highly reflective in one wavelength the probe uses, so the underground lakes showed up as a bright spot.
Another option for detecting subsurface water is through doppler shifts in a probe on the surface, which allow you to see very precise rotation data. From the data, you can infer quite a bit about the planet's internal structure. NASA is using the InSight lander to do this on Mars, and there have been proposals for sending a dedicated probe to Titan, which usually include the same thing. This has the advantage of not requiring any extra hardware (you can listen in on doppler shifts in the regular communications); however, this will only work for subsurface oceans like the ones suspected to exist on Europa, Titan, Enceladus, etc., so it wouldn't have found the underground lake that Mars Express did.
The Curiosity rover has science equipment for collecting detailed information on the composition of various rocks. It can record all the same spectral data as we can from on Earth, except on specific rocks instead of the surface of the planet as a whole. It also has access to some other methods that can't be used from Earth, like an Alpha Particle Spectrometer (shoot it with alpha particles and see what happens) for collecting even more detailed information.
As far as a sample returns go, looking for water or ice in rocks returned to Earth functions the same as looking for them in situ with a rover, you just don't have to be quite as selective about what instruments you use to analyze the rocks, though you have to be a lot more selective about which rocks you analyze.