They looked at the star light as the planet passed in front of the star and noted what absorption was occurring, because water and other chemicals absorb certain parts of the spectrum. Water has a very distinctive absorption in the IR part of the spectrum, so by looking at the light before and comparing it to that as the planet passes, if you see the absorption of those frequencies in the IR part of the spectrum, then you can say that the starlight had to pass through water, and the only source of that water is the planet.
The fact that they can do this is simply amazing.
Suppose that the planet is marginally Earth-like. Earth is a big rock, surrounded by a little envelope of gas, a small portion of which is water. You can't take a picture of the planet, but as the planet passes in front of the star, the light from the star gets a little bit dimmer. How much dimmer depends on the size of the rock. So, they can measure that change in brightness, and figure that if the star is getting dimmer at periodic intervals, there must be a planet passing in front of it. Now, to detect the water, they have to say that specific components of the starlight are dimmed by a small fraction of the size of the gas envelope surrounding the rock, which is partially transparent to some light, but less transparent to other light.
And from that they can figure out that there's an atmosphere with water.
It's pretty amazing stuff, really.
I must admit that as I see reports of really strange configurations of planets being discovered, especially if there are really huge planets with very short orbits, I have to wonder if there might be some other explanations for the periodicity of light shifts, and I wonder just how clear the light shifts really are. If you were to plot out successive light measurements on a graph, would it really be obvious that there were periodic changes in intensity, or is this the sort of thing that can only be sorted out by taking Fourier transforms and picking out the relevant frequencies, which are too faint to be noticed by humans looking at a chart?
I'm not expecting answers to that, by the way. I assume that these guys check each others' math and that regardless of how they are doing it, it's pretty clear that there are planets. I'm just marveling that it's possible.