One way it could work is this:
The sensor consists of an infrared LED (like you find in TV remote controls), with an infrared sensor next to it, but shielded from it.
This combination points at the glass head-on. In normal circumstances (dry windscreen), the infrared light from the LED goes either straight through the glass, and a small portion gets reflected back (total internal reflection, the same effect that makes the "dip" position of a rear view mirror work).
When a water droplet is on the windscreen, it forms a half-sphere on the glass surface. This curve in its outer surface is ideal for reflecting light back to the sensor.
The other way would be that it's sensing the water on the windscreen rather than droplets. Total internal reflection depends on the difference in the materials at a surface boundary. If the beam is fired at the glass at an angle, under dry conditions it may be reflected by the outside-of-the-car surface of the glass (like the dipped mirror), but when wet the reflection from the glass-water boundary doesn't happen in the same way. It's the same effect that makes it easy to see a piece of glass in dry air, but put it inside a washing-up bowl of water and it becomes almost invisible.