I’ve heard a piece of music, but I don’t know its name or who performs it. How can I find this information?
If the music is used in a film, it is usually listed in the credits. IMDB.com is a great website to find the music used in films; find the film's page, then find the link to its soundtracks (or just add "soundtrack" to the end of the film's URL, before the question mark e.g. http://www.imdb.com/title/tt2294629/soundtrack).
If the song has lyrics, search the web by the text you hear. Verify that you found and under some success this may give you the exact name of the song. Then you can search for the sheet music or MIDI files (MIDI files can be opened with some tool like MuseScore to produce the sheet music as well).
If there is no lyrics, options are much more limited. If you hear and recognize at least some chords, it may be still possible to search for the string like "c am dm g7 songs" (add "songs" or "chords" to tell the search engine these are not street numbers). This returns a lot of useless hits but if the guessed sequence is long enough, you may hit the needed song at the end.
There are several services on the internet which can help you with that.
If you have access to a recording of the song
If you have access to a recording of the song and a smartphone, Shazam can help you. It’s a service which helps you identify a song by computing a “fingerprint” from the sounds it record. To use the service, you need to download their app on a smartphone.
If you just have the song stuck in your head
If you don’t have access to a recording, or if you’re somehow unable to use Shazam, you can use a query by humming service, which tries to find the song by asking you to sing, hum or whistle its theme.
Midomi, for example, provides this service: go to their web page, hit the “Click to hum or sing”, sing (or hum or whistle) for a few seconds and click the button again.
If you’d rather use your phone to do the same, the SoundHound app provides the very same service.
If you're a musician, you can also visit Musipedia where you'll be able to search using either a keyboard, Parson’s contours, rhythms or various other tools.