A question we're asked over and over is "When I get the Froyo/Gingerbread update, will it erase my phone?" The short answer is that it shouldn't. When you get an over-the-air (read: official) update, it's more of a surgical strike than a carpet bombing. Your phone is partitioned (much like a hard drive -- or multiple drives, actually) so that part of the OS can be rewritten without disturbing the data on another part. That's how your apps, contacts, photos, etc. (should) remain untouched after an update.

If you're loading a custom ROM, leaked ROM or flash from an RUU, all bets are off. Sometimes you'll need to wipe the data and cache partitions. Or maybe not. Point is, read whatever forum thread you've been lurking in before taking that plunge. And, yes, you should back up your contacts from time to time and make sure they're safe somewhere other than on your phone.