Fly-away hair is a matter of physics. Friction causes static. In the process, tiny positively charged elements are created in your hair. This process is also known as ionisation. The individual hair winds up positively charged with the like charges repelling each other. This makes your hair go haywire. By the way, the vexing problem gets worse the drier the hair is and the more it needs care. A conditioning rinse or spray treatment after shampooing your hair are therefore the best remedies for curing the shock headed look.
Here is a trick do keep dry hair from flying off your head. Rub the tiniest amount of hair wax or pomade between the palms of your hands. Then run your palms about one quarter or half an inch over the still well-behaved portion of your hair. This is how you tame the unruly outliers without distributing wax into your entire hair. This method works just as well with hair end tonic instead of wax or pomade.
Working your hair with the proper brush will also bring the fly-away hair back in line. Brushes with natural bristles tame your hair better than brushes with plastic bristles, and they are also gentler. In case your hair always tends to fly up, put a little hair spray for dry or stressed hair on the bristles and then pull the brush through your hair.