A windsock is one of the simplest things known to man. It is a sock of material that is sown into the shape of a tube. The tube material is cut to form a taper when stitched together. This taper effect allows the wind sock to float in the air due to the pressure causes inside. The tunneling effect of the wind through the tapered "sock" causes lift and makes the wind sock stick out like it does. However, this only works when there is wind to blow through the sock.
Not So Simple
A windsock may not be that simple. There are aerodynamics involved and some additional parts that make it work. The first additional part is the sock hoop that is stitched into the sock opening. This metal wire is round, and fits on the end that will face the wind. The main function is to keep the sock open, so wind can blow through it. The other part is the swivel attached to the hoop. This swivel is mounted on the pole. When the wind changes direction, it allows the sock to swing around and open into the wind.
Aerodynamics for Windsocks
The aerodynamics of a windsock are complex but basically they involve compression. The compression is very small but it is enough to force the sock up and out. When wind enters the sock at the large end it is forced down the tapered tube. As the tube gets smaller, the pressure and speed of the wind is increased. This pushes out on the walls of the sock making it stick straight out. It also causes some turbulence inside the sock that makes it flutter. Having a large opening and smaller exit gives the wind sock all the features it needs to act like a funnel for wind, increasing its velocity and force to keep the sock "inflated" and at an angle above the surrounding winds.