Jim did an excellent job of describing how to hear intervals and melodies.
There are a couple other aspects of music that can really help you to be a better performer and listener, if you get used to looking for them.
When I'm transcribing or learning a piece, I try to listen first broadly, then in more detail. How much time I spend listening at each stage depends on the density of the music.
Whenever you get a chance, listen with the music in front of you. This will help you learn both how great performers interpret pieces and improve your ear's ability to recognize patterns and intervals.
Form is the big picture of a piece. While listening to small examples (like usual in college ear training), form isn't that important, but when you're playing or analyzing in preparation for learning, form is easy to overlook but can make everything "click" together.
You need to listen for themes, repeated sections, and other audio cues of where the music is going. If you have an idea of what the form is, you can think the way the composer did, which usually makes the logic behind the piece stand out. This makes listening more enjoyable and learning much easier.
Learning to hear harmony will make figuring out the melody much easier, and enable improvisation. Listen for how the bass moves, and listen for the quality (major/minor/diminished/augmented) of the chord to figure out the inversion. If you know what chord you're working with, you can narrow down the pitches that might be going on the melodies and harmonies.
Don't forget to listen to the rhythm! Many patterns are easy to play by ear, but it's still good to be aware if you're playing a triplet or duplet, especially if you've got a cross rhythm going on. Of course, if you're percussion like me, rhythms are generally dense and complex so playing by ear is very difficult.
I wouldn't start trying to figure out the melody until I had at least a rough idea of these three. Once you know what's happening in the form, harmony, and rhythm, you have a deep understanding of the piece and the melody should fall into place, with far fewer errors.
A lot of ear training is checked through transcription, so a good practice technique is to listen to a piece that you can find the music for and try to write down all the parts you can hear for a few bars. This is VERY challenging, especially for extended passages. See what percentage of the layers you can transcribe accurately with 5 listens. At first keep the exercises short, and gradually get longer.
In college, we used the Bach chorales for a lot of our early ear training because they follow a very strict set of rules; the same ones used in most music written since the 1700s. They are all public domain so recordings and transcriptions are available easily.