The flail is a medieval weapon consisting of a strong wooden or steel rod with a swinging head attached. The most common form of flail is a wooden handle with an iron rod attached by a short section of chain. Other versions may feature a much nastier cylindrical spiked head, or even a spiked ball with a much longer chain (this type is often incorrectly called a morning star).
The flail can traces it roots back to a simple grain threshing tool. Someone at one point realized what a powerful weapon it could be, and invented the first simple flail. During the 12th century the flail was used widely by the followers of Peter the Hermit. These followers used flails with spiked heads as their primary weapon during the crusades. Flails continued to see some use right up until the 1920's when the Polish fashioned flails to defend themselves against Russian troops.
The main advantage to using a flail is the incredible force with with the head hits. Properly wielded even a small flail can crush most plate or mail armor. But the flail is slow and takes some training to use properly. A missed swing gives your enemy ample time to attack as you recover. The spiked ball versions can be even more dangerous to the untrained user.
Foot soldiers would most commonly use a heavy, four foot long flail that required two hand to properly swing. These heavier flails could down most knights or horses in a single mighty swing. While mounted troops favored a lighter, two foot long flail that was not as powerful as the larger version. Despite what you may have seen in movies, mounted troops seldom used the spiked ball version of the flail, as it is was far to easy to whack your own horse with a missed shot.
The flail is a common weapon in most Fantasy fiction and role-playing games. Clerics especially favor this weapon as it is more damaging than a mace, and is an allowed weapon by most deities. In the AD&D worlds the Flinds (a hyena-like humanoid), have developed their own specialized version called the flindbar, which is faster and more damaging than a standard flail.