Rather than reading about it, I've experienced this firsthand in martial arts, and you're dead right - the purpose is to "lariat" around any obstructions in front of the victim. They can hold up a shield, or a sword, and it won't help them when used in the normal way - it'll either loop around the side and smash their face, or more likely, wrench the sword/shield out of their hands - either one gets the job done - and it can be done to multiple people at once.

The biggest point to the flail was to be a 'focused impact' weapon, and to have much more heft than a person could manage with a mace. The primary weapon used against people in plate armor was impact weapons like this - especially with sharp studs on them, because - believe it or not, armor actually worked. Swords couldn't cut through armor, and it was really hard to get around armor - nobody went after a knight by hoping to slide a blade through joints in the armor (as has been depicted in various films), because it's nearly impossible to do - nobody's going to stand still and just let you do it, and even if they did, it's surprisingly hard to control a sword like that (to illustrate this, try flipping a light switch with the far end of a broom handle - that's a still, unmoving target, and you might find it takes a rather surprising amount of manual control).

If you wanted to take out a dismounted knight, you went after one by punching a hole in his armor (or by hitting the armor with so much heft that it dents; either one works). Swords aren't an option, and until the late period crossbows/arbalests, very few arrows had the stopping power to punch through it (english longbows being a noted exception). The best bet was a spike - basically a large chisel on a stick. It needs to have a lot of momentum to have a hope of punching through - unfortunately this usually means it has to be extremely heavy. This usually results in a really unwieldy thing with the heft of a sledgehammer, that's so slow you can't fight well with it and are liable to be unable to dodge/block someone striking you with something much faster.

A moving weight on a chain solves the momentum problem by moving in a circle - it gives much more momentum than you could get in a single swing, since you can accelerate over a few rotations and continue to swing the weapon. It also is an inherently scary-looking thing, and has a powerful "crowd control" effect in a melee - the big point of a commander fielding something like this is to break up enemy cohesion/formations. A guy swinging a flail around repels people like oil and water. A few of these who bum rush a shield line (along with a general charge of their fellow fighters) are - more often than not, going to make a hole in the shield line not from actually hitting anybody, but from regular humans just getting the hell out of the way. Break up the enemy line, and they lose all of the strengths of being in formation. This is what "shock troops" are.

The flail is very similar to a number of asian designs (some of which are fairly mundane western-looking things, and others which are pretty exotic like the meteor-hammer/monkey's paw).

It's absolutely daft to dismiss a design like this, where not only do all of the parts of its shape serve a very direct, functional purpose, but also which has managed to "independently evolve" on multiple continents because it's just the only reasonable solution to dealing with armored shield-bearers. It's crazy.