If you want to be published by a publishing house, then you need a literary agent. Finding an agent is a little like a bird courtship. One bird (the writer) dances and displays (writes a query letter) in front of the potential partner (the agent). Usually the agent ignores the writer, after all, they may get hundreds of query letters a week. They know it is a long relationship before they see any benefit and so they seek something they may not even be able to articulate, but trust they will recognize it when they see it.
The writer becomes a traveler, moving from courtship to courtship seeking acceptance. And then if an agent does show interest, the writer must see if there is truly a meeting of minds. Does the agent have a similar vision for their novel.
Somehow, as random as this must sound, the right agent and writer do usually find themselves.
But it's easy to see why many authors skip the courtship and choose self-publishing.