In Latin there was a word that stood for 'a winnowing tool' or 'whip'. It was flagellum (which was, itself, a diminutive, or more concise, form of the word: flagrum: 'to whip'). Some sources give the origin of the Latin as a Proto-Indo-European word: bhlag, which signified 'to beat'. The people of the northern Europe region who spoke Old High German converted the Latin word into its own: flegel. The people who spoke Low German or Middle Dutch contrived the word: vlegel. Old English used the Old High German form of flegel with a slight variation to become flighel or fligel. In the Middle English, the word was written as fleil, while the Anglo-French spelled the word flael. While the word, with its meaning of a tool for beating or winnowing of grain, came into use by the year 1100, the modern usage of the spelling flail was derived from its earlier sources around the 15th Century.
The flail was a tool used to separate useful grain seeds from husks and other unusable parts of the wheat or rye plant. (Corn, in some cases, might also be threshed to remove the kernels from the cobs.) The tool consists of a long wood pole or staff, called the hand-staff, a shorter wood pole, called the swingle (variously, the sweple, swiple or supple), and a strip of leather or hemp rope connecting the two poles. The wood most commonly used for the parts of the flail was holly. Holly is fine-grained and not easily broken; it made the ideal material for the flail, which took a lot of beating. The hand-staff is aptly named because the user, known as a thresher, would grasp, with both hands, the longer of the two wood poles. The swingle (which was derived from the Old English: swingan, meaning 'to strike' or 'beat') would hang freely from the one end of the hand-staff, called its 'head'. The flexible connection between the two poles being the leather strip or hemp rope, the swingle could be swung in any direction.
The job of threshing was performed on a dirt floor in a barn. Wooden floors, no matter how well constructed, would have enough cracks between the planks to lose a substantial amount of the grain. The dirt floor would be prepared by being swept clean. A dirt floor of the barn would have, over time, become very tightly packed, and therefore could be 'swept clean' of loosed dirt, rocks and stray items. After sweeping the floor, the thresher would sprinkle it with water just to make it all the more free of any loose dust. A quantity of straw (i.e. the harvested and dried grain plant, whether wheat or rye) would be piled onto the center of the floor. If there were more than one thresher, they would position themselves around the strawpile. The thresher would use an up and down motion to slap the swingle down and onto the pile of straw. Rather, the thresher simply moved the hand-staff so that it's head alternated being raised up and then directed back down to the floor. The swingle could not help but be slapped down flat against the pile of grain-bearing straw. The continual striking of the flail's swingle would force the grain kernels to be knocked out of the heads of the straw. The action did not squeeze out the grain, but instead shook it out (keeping the grain intact and not crushed). An astute farmer would build his barn with threshing in mind. That means that doors would be placed on opposite sides; those sides being against the direction of the wind. As the wind blew through the barn, it would whisk the bits of husk, broken up and aggravated by the threshing activity, away from the central pile.
The photos attached to this post show a flail from the 1800s.