At first it was all through friends or connections. Then I found a job as the first engineer in a two person startup, posted on Craigslist (that was back in 2009). Eight years later that startup was sold for half a billion dollars. Today I would go directly to websites of companies I’m interested in, then find someone on LinkedIn who works there.
But - first you better make sure you’re someone they would want to hire! Casually mentioning some cool project you put on Github, relevant to what they are doing, helps a lot in my experience.