Shazam, like other iPhone music apps, can identify the name, album, and artist of a song just by hearing it over your iPhone's microphone. You'll have to hold the iPhone mic close to the speaker for a few seconds as a song plays--on the radio, in a coffeeshop, or at a party. More often than not, Shazam will accurately report back with the song's name, and (if available) the album art, artist bio, related YouTube videos, and iTunes purchasing links. Also, it had some problems linking to the right YouTube video at times.
Shazam is gratifyingly fast and accurate, but it works best in quieter environments without noise interference. Again, the closer you can get the bottom of your iPhone butted up to the source of the music, the better. Shazam also doesn't do well with more obscure music, and it only helps out with recorded music (i.e., you can't hum a few bars like a competitor). Ad-supported Shazam keeps track of your "tags" (the songs that you've asked about) and lets you add photos and share your tags via e-mail.