Mail, contacts, and calendars: If you're using a Gmail account or other POP or IMAP-based account for mail on your smartphone, it's already syncing to a central server, and you should be able to add that account to your new iPhone with few issues. Apple's iOS has automatic setup for those using Microsoft Exchange, Gmail, Yahoo, Aol, or Hotmail; you'll also be able to manually set up a POP or IMAP account for mail, LDAP or CardDAV for contacts, or CalDAV for calendars. You can alternatively use Apple's free iCloud service to set up a new email account.
Music, videos, and photos: Your new iPhone uses iTunes to sync any local music, TV, movies, and photos from your computer to the device. If you've been syncing that information with your smartphone, it's easy enough sync that data with your Apple device--you just have to know where the content is located on your smartphone and get it over to your computer. Once you've done that, add it to iTunes; to sync your photos, add them to iPhoto or Aperture (on a Mac) or place them in your Pictures folder (on a PC).
If you've purchased content through your smartphone that hasn't been copied to your computer (say, if you're using Amazon Cloud Drive), you should be able to download it to your desktop system, or, at the very least, install an app on the iPhone (like the Kindle app for book purchases) that lets you access the information.
Apps and miscellany: Unfortunately, you can't port any Windows or Android apps from your old device to your iPhone. On the upside, you may be able to find parallel versions of those apps on Apple's App Store (for instance, if you're using Dropbox on your smartphone, you can download the company's iOS app and continue to access your Dropbox data). If you have apps with valuable information you don't want to lose (notes apps, to-do lists, etc), you can poke around to see if there's any way of exporting that information; otherwise, you'll be out of luck.
SMS and MMS logs, while not transferrable, are in theory rescuable, depending on what kind of smartphone you own, but it requires a lot of legwork on your end. You won't be able to add them to your new iPhone, however; you'll simply be saving them to your computer. There are a variety of different programs available for exporting messages from your smartphones--SMS Backup & Restore for Android appears to be one popular option. As I haven't used it, I can't personally recommend it, but you can always search Google to bring up more options.
If you're upgrading from a feature phone
Yes, it's finally time to toss that Razr aside for something a little more full-featured. But what about your contacts and your photos? If you're on a phone with a nano-SIM card, it's easy enough to rescue the first; for the second, you'll need Bluetooth support or a connection cable for your device.
You can transfer your contacts one of two ways. If your old device uses a nano-SIM card, you can copy all your contacts to its SIM; once you've set up your iPhone 5, you can copy those contacts by swapping out your iPhone's card with your old nano-SIM and heading to Settings > Mail, Contacts, Calendars > Import SIM Contacts. Once the import has completed, eject your old SIM and put the one that came with the iPhone 5 back in its tray. (If you're worried about doing this yourself, you can always head down to your nearest Apple Store--any employee should be able to do it for you.)
If your phone has a SIM card that doesn't fit in the iPhone 5, but it comes with a USB cable for connecting it to your computer, you may be able to transfer your contacts (and your photos) by exporting them through software. (This, obviously, depends on your phone; check its manual or do a Google search for specific transfer information.)
Activate your iPhone 5
If you purchased your iPhone in the Apple Store, you may have already activated it with a Specialist by your side. But if you've received your new gadget in the mail, or you opted not to activate immediately, here's a guide on how to do so.
Unbox your iPhone and turn it on by pressing the On/Off switch. A welcome screen greets you, displaying a Slide To Set Up slider that rotates between different languages. (If you need quick access to your device's IMEI or ICCID number without setting up the phone, you can tap the information button [represented by a lowercase i] located directly above the slider.)
Once you begin the activation process, you're asked to pick your language and country, and whether you'd like to enable Location Services. This allows Apple apps (and third-party apps) to access your location via Wi-Fi networks and your GPS (Global Positioning System) location. Your iPhone then checks for any Wi-Fi networks in the area that your phone can connect to; if there aren't any, or if you'd rather use your cellular service, just tap the Next button.
From here, you can set up your device as a brand-new phone or, if you're upgrading from an old iPhone, you can restore your data from an iCloud or iTunes backup.
Restore from an iCloud backup
If you have an iCloud account and have backed up a previous iPhone or iPod touch incarnation using iCloud's Backup feature, you can use this backup to restore your data to your new iPhone (though you'll need to be on a Wi-Fi network to do so). To restore your data, sign in to your iCloud account; agree to Apple's terms and conditions; and then choose which backup file you'd like to use, and tap the blue Restore button in the top right corner of the screen. (Depending on the speed of your Wi-Fi connection, this process can take anywhere from a few minutes to a few hours.)
Restore from an iTunes backup
If you tap Restore From iTunes Backup, you're brought to the Connect To iTunes screen. Connect your iPhone to your computer and open iTunes; after clicking your device in the source list, you'll see the Set Up Your iPhone screen, which asks if you'd like to set it up as a new iPhone or restore from a specific backup. Choose the correct backup, and click the Continue button to proceed. This process is significantly faster than restoring from iCloud, because you're transferring data over USB, not over Wi-Fi.
Add an Apple ID
If you choose to set up your iPhone as a new device--or after you choose an iCloud backup to restore from--the first thing you have to do is supply an Apple ID, or create one if you don't have one. If you've ever purchased something from the iTunes Store, you've signed up for an Apple ID (it's usually your primary email address). Your login information for Apple's iCloud service should also work for signing in.
Use your current Apple ID: Already have an Apple ID? Tap the Sign In With An Apple ID button and enter your username (usually your email address) and password. Apple then spends a few moments linking your device to your Apple ID.
Sign up for a new Apple ID: If you don't have an Apple ID, it's easy enough to create one by tapping the Create A Free Apple ID button. You need to enter your birthday, name, email address (or create a new iCloud email address), a password, a security question (in case you forget your password), and whether you'd like to receive email updates from Apple. Once you've entered all your information, you're asked to read and agree to the terms and conditions, and Apple then registers your Apple ID.