Many types exist, from small police whistles (also called pea whistles or penny whistles), to much larger steam whistles used on locomotives and ships. They are not usually considered 'musical' as such, but musical versions that work on the same principle exist, for example the tin whistle, organ pipes and the Recorder.
The whistle works by causing the smooth flow of air to be split by a narrow blade, sometimes called a 'fipple', creating a turbulent vortex which causes the air to vibrate. By attaching a resonant chamber to the basic whistle, it may be tuned to a particular note and made louder. The length of the chamber typically defines the resonant frequency. A whistle may also contain a small light ball, usually called the pea, which rattles around inside, creating a chaotic vibrato effect that intensifies the sound.
A steam whistle works the same way, but using steam as a source of pressure - such whistles may produce extremely high sound intensities.
Sometimes, unintentional whistles can be set up. A common one is the opened sunroof of a car - air passing over the top of the vehicle can, at certain speeds, strike the back edge of the sunroof, creating a very low frequency whistle which is resonated by the closed interior of the car. Since the sound frequency is infrasonic, about 4 Hz or so, the effect is very uncomfortable for occupants, who feel the vibration rather than hear it. Such low frequencies can induce nausea, headache, disorientation and dizziness. The effect can be prevented by opening a side window a few inches.