Another brick in the wall
You might be thinking, “Wouldn’t it be easier not to worry about headroom, but to just put a brickwall limiter on the track so that it can’t hit 0 dB?” You could do that, because a brickwall limiter does provide an absolute limit to how high a level can go. The problem is that you’d be squashing down those peaks, and that will result in a reduction to your song’s dynamic range — the difference between the quietest and loudest part of your song.
A mix that's been overcompressed and has virtually no headroom
For most musical styles, reducing the dynamic range significantly will make the song sound less pleasing to the listener. You have to deal with headroom issues in the recording, mixing and mastering stages.
Tracking with headroom
If you record your tracks with sufficient headroom, you’ll make it easier to mix them, as well. You want to keep your input levels low enough that, even at the loudest point in a performance, the signal never gets higher than around -8 dB . When recording vocals, which can have a very large dynamic range, you’ll have to set your levels pretty low in order to ensure that the peaks don’t hit 0 dB. There’s a misconception that many recording musicians have, left over from the analog days, that if you don’t get your signal as close to 0 as you can without going over, the audio recorded will be noisy and not as high quality.
Keep your recording levels low enough so the peaks are no higher than about -8 dB
That is definitely not the case when recording digitally at 24-bit resolution, the noise floor (the level at which you start hearing background hiss along with what you’re recording, because the input level is so low) is significantly lower than on 16-bit recordings and even lower compared to analog recording, where noise is a real issue. In your 24-bit DAW session, you can record your tracks with average levels in the neighborhood of -20 dB, with peaks between -8 and-10 dB, and you’ll still get full fidelity, but will leave plenty of headroom.
Don’t squash that mix
As mentioned, if you record your tracks low enough, you’ll have enough headroom when they’re summed together in your mix. You want headroom when mixing, not only for avoiding distortion and keeping your dynamic range wide, but also for making sure that you have plenty of room to maneuver when you’re adjusting the levels of the various tracks in a mix. If the levels start getting boosted either by fader moves or EQ, or other processing plug-ins, you can get to a point where you have no room to make a particular track loud enough, without it lighting the clip indicator (which should be set to stay on once lit so you'll know there was a clip on that track). When that happens, you have to reduce all your track levels equally for the entire song, which, if you have automation in your mix, can be a tedious task. One good tip is to start your mix with all the levels (except the master) below their 0 dB default level, so you have more room to maneuver.
If you plan on using a master bus compressor or limiter, which probably is not a good idea unless you have a lot of mixing experience, remember that the more gain reduction you dial in on the master track, the smaller the dynamic range of the mix. You want to leave plenty of headroom on your mixed track, so that the mastering engineer (even you, if you’re doing the mastering yourself) has room to work with on the overall level. A good mastering engineer will apply limiting, but won’t over-compress your music, thus keeping it sounding dynamic. If your mixes are heavily squashed prior to mastering, it will be much harder to do that. So mix with plenty of headroom, keeping your master fader at 0 dB if possible, and you should be good to go level wise.