Although a messy bun is intended to look messy, it really is organized chaos, and takes a bit of practice to master. There are many different techniques, and some work better on different hair types and lengths. The basic technique is to pull the hair into a ponytail, and then make loops out of the tail, arrange them randomly, and pin them in place. I often make the first loop when putting the hair in the ponytail by not pulling the tail all the way through on the last loop of the hairband, like the workout bun. You can also twist the hair and wrap it around as if making a regular bun, but keep it sloppy and don't tuck the ends in.
Here is a collection of videos from other places that will give you an idea of some different ways of doing it. I've spent way too much time searching the internet for good videos and found none better than these that I started with.Babes in Hairland "My Way"
Babes in Hairland Long Hair Messy Bun
Girly Dos by Jenn
Cutie Pie Hair Creations
Sweetheart wanted to show off his new haircut and be in a picture, too.