There are a large number of ways an author can get an agent. The best way is to attend writers conferences and meet with some face-to-face and find a connection with one. Another, the most common way, is to research the agents and learn about them that way.
That almost sounds like stalking, but you don’t want to go into their personal lives, just try to learn what types of books they handle, who they have represented in the past, who they represent now, what their last sale was and things like that. Once you determine on a agent, you need to read their submission guidelines and follow them. Some agents want everything by email while others prefer snail mail.
It helps to ensure that you have their names spelled correctly, and that you get their gender correct in your query letter. I don’t have an agent, myself. I sometimes think that I should get one and others that I should just self publish my first novel. I am only repeating the advice from people on the web who know about getting an agent. Most of it is common sense. If you want someone to represent your work, make sure your work is the kind of work they handle, which is common sense. It’s also common sense to check that they are still working as agents. People change offices, companies and some people actually retire.
Names are important as well. I know that I am irritated when people misspell my name, I can only assume that others would be irritated by being addressed with the wrong spelling. There’s a difference between O’Bryen and O’Brien. It may not seem like much, but it could be a deal breaker because it shows the sender didn’t do its homework. My brother used to get mail addressed to “Ms. Gary”. They were usually advertisements so he was more amused than irritated, but that too, is an example of not doing research properly. Sometimes, I would get mail addressed to Mrs. Lisa. I’m not married and never have been. Research is important. Know how to address the recipient and you will go farther than if you make the sorts of mistakes I mention here.
As I said, most of it is just common sense. If you don’t know the gender of the person to whom you are addressing your correspondence, keep it genderless as much as you can. Keep your query simple. Let your words speak, fancy fonts don’t always work well. if it is hard to read, it won’t get read. Remember, you are sending your work to someone who reads for a living. If they have tired eyes, they won’t appreciate fancy fonts or weird color combinations.
Proof read your letter before sending it. Read it aloud and don’t depend on spell check to catch your mistakes. It can only tell you the word is spelled correctly, not that it is the correct word. This sort of thing should be second nature to an author looking for an agent. You have to be professional. That goes for your word choices as well. “Dear X,” is much better than “Howdy.”
Use common sense and you will do fine.