I'm probably bordering on neurotic about this, but I can't stand to have anything "extra" on my person during a race. And, I also do whatever I can to avoid my race bib flapping, rubbing, or annoying me in any way. A lot of people like to wear a race belt with their bib attached. If you like those, great. If you don't, and you're more like me, here is the "science" of pinning your bib like a pro.
Crumple It. A lot. This is my favorite bib trick, which was shared with me by Ryan Hall. The bibs are made with a natural fiber (so that they don't disintegrate when they get wet), and respond really well to being crumpled up. Take a look at any of Ryan's race photos (see example below from the 2011 Boston Marathon, note Ryan's wrinkled bib to everyone else's smooth bib). I spend a good few minutes crumpling up any bib I get, unless there is a non-bendable timing chip, so that it moves with my body like cloth, not like card stock.
Feel Free to Fold. Unless you've been given specific directions to leave a bib unfolded, you can make it as small as you want. Some of today's race bibs are gigantic, so you'll see me folding in the sides a lot unless it's already pretty small.
Pin to a Non-Folding Body Spot. The worst spot to pin a bib is at the bottom of your shirt/singlet, in my opinion. I like to pin just below the logo on my singlet, so the bib is on my core and out of the way of my legs/waist. In the cases where I pin the bib to my shorts, I always pin on the side of my quad.
Always Pack Back-up Pins. Races run out of pins all the time. Bring your own!
Remove the Bib ASAP After the Race. I've made the mistake of tossing a singlet into my bag, forgetting about it for a day, then pulling it out to find that the pins have rusted from the sweat on the singlet, making some gross stains on the singlet. You're also less likely to accidently rip a hole in your singlet or shirt if you take the bib off before you take the shirt off.