Lots of good SCA posts...so how about a historical view?
As said earlier in the post by Malhost, the flail began life as a grain thresher, a long rod connected to a short rod by a two interlocking perpendicular rings. As it progress from farm tool to weapon, the head become metal and grew in weight and size (width, not height). As the weapon continued to progress, the rings became a heavy chain and the head become more rounded (darn but those ignorant medieval weapons makers had a pretty good grasp of physics.

) The chain grew in length and the haft shortened. The head sprouted spikes and eventually you saw variation with multiple heads. So that is the evolution of the weapon, the question though is about usage, but the background information pertains as you'll see.
In the first iteration, the flail was most likely used by peasants in riots, much like the pitch fork, the sickle, the pruning hook and the scythe (all of which later spawned pole arms or the like.) There is very little hard data on when it was first used, but the leap from farm tool to weapon usually had its roots in farmer gets mad and uses what is available to kill local nobility or fellow farmer.
Of course, nobles were smarter than your average peasant and quickly adapted a good thing to more base uses. (ie war). The original heavy head flail (just rings, no chain) had a heck of a whack, but was more like a pole arm than an actual personal weapon. Should you hit, they were devastatingly powerful (more of that applied physics that had not yet been invented) but getting a hit was a real challenge. Never to throw out a good idea, the good nobles decided to shorten the haft and lengthen the pivot point, in this case with a chain. You could say it was a 'smashing' success.
The ability of the flail to hit the opponent was increased and the fact that the occasional 'miss' would still find its mark (via wrapping around a shield, arm, leg, weapon...whatever.)was an added bonus. At some point this became such a marvelous idea that they shortened the haft again, lengthened the chain again and put this former infantry weapon in the hands of mounted soldiers. The flail had suddenly become a VERY effective cavalry weapon, one that needed little practice to use (though extensive practice to master) was capable of unseating a rider, killing an infantryman outright (rumor is this is how the idea of polo came to be) disarming an opponent, etc. Of course like all Medieval weapons the best way to upgrade is to add spikes, so they did. And if one head is good, then two or more should be that much better, right? Well, it seems that at some point, the number of heads became the ultimate downfall of the weapon. Someone got the bright idea that a Cat o' nine tails crossed with a Flail was a good idea...it wasn't, it was heavy, unwieldy and just plain laughable. They actually have an example of two at the Royal Museum in London, really gaudy things.
So to answer your question, yes, you could swing around the shield, though it wasn't the intended purpose, it worked. Eventually, the idea of tripping and opponent came into being another reason for having a second weapon (especially an axe). The user would wrap the legs, pull, then cleave the skull open with the axe of the now prone defender. If the user was practiced enough, they could draw their second weapon and still get in a killing blow before the defender could regain their wits, which of course allowed them to use a shield.