I've always had long hair. Currently, sometimes I need to keep it tied up to A) fit under a helmet, and B) keep it out of the way of rotating propellers.
I've always found it easiest to use some form of plait (braid) because that's the best way of stopping bits escaping. Some styles I've used are:
- Single French plait down the back, then curl up the plait and pin it into a bun with LOTS of hairpins. This also works with an ordinary plait, but it's not quite as secure as the French plait gives you something firm to pin the bun to. If you're doing an ordinary plait, make a ponytail first (with a rubber band) then plait the ponytail. It makes the plait more stable and easier to pin into a bun that doesn't come apart.
- High ponytail, plait the ponytail, curl it up into a bun on the top of my head with LOTS of hairpins.
- Loose ordinary plait, curl it up, and hold it in place with a U-shaped hairpin (elegant and quick, but less stable).
- French plait around my head, then wind the end of the plait around and pin it in place (very secure, but takes some time in the morning - best for under a helmet).
If it's important that you don't have bits of hair coming loose, or you want to be very sure that whatever up-do you've got doesn't come apart, get some firm-hold hairspray. I'm a child of the 1980s, so I've seen some very unnatural hair shapes held in place by hairspray!
I had short-ish hair for one period during my life, and I gave up on that quickly because I found short-ish hair was more trouble than long hair. At least with long hair, once you've pinned it up properly, it will stay up. Short-ish hair tends to escape more easily.