Through the iTunes program. But, with the iPhone 5, you need to have iTunes version 10.7. You also need to have an Intel-based iMac running at least OS 10.6.8.
If you have an older PowerPC iMac (G3, G4, G5), running OS 105.8 or older, you can't sync a new iPhone 5 with it.
If you have an Intel-based iMac, running at least 10.6.8, and iTunes version 10.7, when you connect the iPhone to your iMac through the phones included Lightning to USB cable, iTunes should automatically launch. When the iTunes window appears, in the column on the leftside of the window, you should see Devices, and under that, the iPhone should be listed.
If this is your first time syncing the phone, it will walk you through it. At the top of the window you'll see buttons for Music, Photos, Videos, Apps, Tones, Mail and Contacts, and other items that you can click on and decide what items you want to sync to the iPhone.
Here is a link to the iPhone discussion forum:
Here is a link to Intel-based iMacs:
Enjoy your new iPhone 5.