First of all, write a killer query letter. This should consist of a spectacular opening line. Your log line should sell your book. If this catches the attention of an agent, he/she will continue reading your pitch. If not, well, that person will probably discard and go on to the next one. After your log line, you should write a concise three-paragraph letter about your book. This needs to include specific plot points, including the ending. Don't tell WHY you wrote the book, SHOW the agent your beautiful prose. Once their interest is piqued, they will contact you. Then the real work begins.
Second, have your manuscript editor ready. By that I mean have it polished to as close to perfection as you can get it. Everyone is busy these days, and the less an agent has to help you mold, the better. Show the agent you're a hard worker and know how to craft a selling story. Once the agent is impressed and signs you to a contract, he/she will be your best friend in the publishing business. They will pitch your manuscript to the bigger publishing houses, saving you that hassle. They will find the best deal for you, freeing you up to write. Of course, you still will be expected to help market your work. But, an agent will be your friend and advocate.
Lastly, only query to people interested in the type of story you've written. For example, I write historical fiction, so I need not pitch to agents looking for romance or science fiction. Send your query letter only to those who are looking for your genre. It's good to check if that agent is a member of the Association of Authors' Representatives. If not, do some research. Not every good agent is in the AAR, but most are.
Don't go it alone. Have critique partners read your work, and then be willing to accept criticism. Listen to what other writers say and then apply what works to your manuscript. They are your friends and are trying to help. Be willing to do the same when they ask. Writers need to help writers. Speaking of which, writing coach Brooke Warner has excellent advice in her blog and social media posts. I suggest connecting with her.
Again, finding and signing with an agent can be scary. But, in the end, very rewarding. In fact, most agents are looking for writers they would like to hang out with. Remember, they are just people too.