OK. Here's the science behind it. There are two things to understand straight away.
First of all, it's important to know that it's a SURFACE effect. Even a few molecules of coating or impurity on the glass surface will have a dramatic effect on what you see.
Secondly, the purity of the water and the cleanliness of the glass surface are both factors. That's why you will notice that the water behaves differently between the moment you start cleaning the window (when it is dirty) and when it's finished and clean.
Do you remember seeing an experiment at school when the teacher floated a needle on water? That's possible due to a phenomenon called surface tension. This is due to the water molecules being attracted to each other. This causes the water to form a "skin" at the surface. It's important in lots of different applications.
For an excellent discussion of surface tension see: en.wikipedia.org/wiki/Surface_tension. If you ignore the mathematical bits, the description is really excellent. I especially recommend the bit on contact angles.What happens on the glass surface is that the molecules of the water are attracted to each other - hence surface tension, and they are also attracted to the molecules on the surface of the glass. In some complex way that I really don't understand very well, these two different attractions "fight" with each other. This causes the droplets of water to make contact with the glass surface at some angle that depends on the strength of the attraction between the water and the glass.
If the attraction of the water molecules to the glass molecules is weak, the contact angle is high (greater than 90 degrees) and the glass is hydrophobic.
If the attraction of the water molecules to the glass molecules is strong, the contact angle is low (less than 90 degrees) and the glass is hydrophilic.
Phew!!!
Interesting things:
1 - Self-cleaning glass is made by depositing a very thin layer of titanium dioxide (TiO
2) on the surface of the glass. This stuff is highly hydrophilic, so the contact angle betwen the water and the TiO
2 is so small, that the water just slides down the vertical surface.
2 - Putting detergent into the water reduces its surface tension dramatically. That's why soapy water will wet hydrophobic glass. (It's a little more complex than that, but it's near enough.)