Well, I can't tell you about the complicated inner-workings, but I know that if you take one apart, you can get a pile of magnesium powder that lights up and is fun

.
Basically, when a flashbang goes off, it makes an incredibly bright falsh, and an incredibly loud bang (Flash+Bang, get it?) so it attacks at least 2 senses at once, and disorients people inside the room, especially considering the change in pressure if ignited inside a closed room. This is very useful for buying a few seconds when entering a room.
Flashbangs, however, aren't as bad as they always seem, at least not the run-of-the-mill ones. In SOI (Marine Infantry School) I was flashbanged inside a room several times, and then a few more in the fleet, you get used to it and learn that if you just close your eyes, turn your head, and cover your ears, you can get through it just fine.