The first part is the aural process. Reconsider how you listen to music. Are you listening with broken headphones where one side is busted? Is the volume too low? You’re not going to hear half the mix. How will you put anything in context with the bass or the lower frequencies? The physical way that you listen is really significant- listening while someone is talking or you’re busy with another brain-heavy activity isn’t actual listening. You’ve got to be in a quiet space and set the volume to a comfortable but decent level where you can hear the entirety of the arrangement, and make sure your speakers are working properly. This doesn’t mean $200 headphones, but try to find the best that you can, because the quality of the sound changes the way you remember and understand what you’re listening to.
Next. The “active” part of the listening. Put the song on. This can be something you’re working on, or just something you want to get to hear better. Close your eyes and try to visualise the music in a blank three-dimensional space surrounding you. Where are all the instruments placed? Where do you “go” when you’re listening for the piano, or the bass? Get comfortable with that space. Now listen for the things you’re working on. It could be a line where the intervals are confusing and large, or a certain rhythmic pattern happening in the background that you want to play against, or just a little slide between a few notes that you aren’t sure of.
Now, the part the does the most: engaging whatever part of your body you require to play your instrument. Technically, you’d be air-guitarring, or table-pianoing, or table-drumming, or whatever you call the act of playing your instrument without actually playing it. If you’re a vocalist, engage your vocal cords to the slightest degree where you can feel where the note you’re trying to get right is- you don’t need to sing it-but engage it enough for you to know where the note is, and how far that tricky jump is. If you’re a pianist, find out what the tonic of the song is and figure out the chords or melody with your ears and see if your fingers can “track” how it goes. Make guesses. They’ll be wrong at first but you’ll get better. This is how a lot of people who play by ear can easily play songs they’ve never actually played before- because they’ve engaged with the piece at a level where they’ve practically already played it in their heads.
Lastly. A wonderful thing that I’ve been doing recently has been listening to tunes at about 75-80% of their actual tempo. If like me you’re trying to get your head around bebop or tunes with really packed rhythmic passages, you’ll find this really useful for breaking down difficult riffs or ornaments into their constituent notes and really hearing the scales being used. If you can’t stand how slow the “slow” passages get, use an app like Transcribe! where you can section, loop and slow down the passages you're working on.
There’s a lot of existing scholarly and unscholarly research on engaged listening, so have a look at the literature on the topic! The whole point of this is to train your ears to teach you how to play. With the right focus, your ears will guide you to the right notes, and half your work will be done even before you touch your instrument.