If you wear headphones during a race, you'll miss out on a lot of the race excitement. You won't be able to listen to bands, hear people cheering, or talk to other runners. There's also a chance that your music listening device could fail during your race, so it's important that you don't get totally dependent on it.
With all that being said, I know that long runs can sometimes get monotonous, especially if you're running alone. You might want to try finding a running group, so you'll have people to run with. Or, try switching up your routes for a change of scenery.
If you really need music for motivation (and there are lots of people who do!), try using it on a low volume or with one earbud out, so you can still hear what's going on around you. You can download songs that are a specific bpm (beats per minute), so they'll match your cadence in your run (if you care about that sort of thing). And if you want to use your iPod for those boring treadmill runs, it's perfectly safe to do that.