When you blow over the end of a bottle, you push a steady stream of air pulses down the bottle. If the rate at which you send the air pulses is right, then the air in the bottle will vibrate to make a sound you can hear.
You alter the note by changing the length of the air column in this case by adding or taking away water.
All wind instruments work by blowing pulses of sound through a tube.