There's loads of reason imo. Feeding, clearing gills, ditching parasites, regulating the swim bladder..... and I also believe that sometimes they're just playing (for lack of a better word).
Head'n'shouldering is a strong indicator for feeding on the deck. Those flicky, splashy shows indicate feeding up in the water (ziggy shows I call them). But ultimately I'll move on to ANY kind of show if I'm not seeing them in front of me. Active fish are normally catchable fish imo.