It just takes a lot more time and patience to do it by ear if the song is complex. Some songs are easy peasy. Some, not so much. But as one said, you can at least start by finding out what key the song is in. And go from there.
There are times when a bass line or guitar part is over my head and I have to find alternative ways to figure it out. It's just all about what level we're at of our understanding of what a guy is doing. Most pro's might be doing stuff that is over our heads until someone shows us, or we plop down and work it out by staying with it. Then once you get something, you're at a new level of skill.
I learned a lot by working Beatles songs like "Daytripper", "Taxman", etc etc. On guitar or bass. Insert whatever artist or song you like. Some are harder to figure out than others. Which is a story unto itself.
Maybe some guys here will help you if you let them know what you're wanting to work out.