Research different agents and the genres they represent. If you wrote a sci-fi novel, it won't do you any good to send a query letter to an agent you specializes in non-fiction or chick lit. If you wrote a chick lit novel, don't query an agent who specializes in thrillers and sci-fi medical mysteries. Knowing this will save everybody time and money.
Research agents to find out who is legit and who is a scam agent. You can look at the "Preditors and Editors" website, or look up agents registered with AAR (Association of Authors' Representatives). AAR accredited agents agree not to charge reading fees, and most other reputable agents will not do this either. If you are asked to pay for a reading of your first chapters, be wary.
You should be leery of agents known for sending advertisements along with their rejection slips. If the agent makes most of his/her money hawking writing guides and editing services, it's probably because he/she is not so good at selling books to editors.
After you've figured out whom to query, write several drafts of your query letter. A query letter is more than a synopsis of your novel. It should say why you are interested in working with the agent, who faces what obstacle in your novel, a word count, and a brief list of your prior publications.
You can find tons of examples of good and bad query letters online, as well as advice on making it unique. Some literary agents have blogs you can check out, or you can get the book listed in the resources.
Should an agent be hooked by your query letter and ask for the first pages, make sure your first pages are not a let down. You must hook a reader (including an agent) early on in the story.
Expect to get many rejection letters, but don't take any of it personally. Agents reject pitches for many reasons--they have enough clients, they already have too many books similar to yours, or they don't think they could sell your book. As the old saying goes, every rejection is one step closer to acceptance.
If you don't have any luck finding a literary agent, you can rework your novel, rework your query letter, get more publishing credits in magazines, or try one of the self publishing routes. The important thing is to keep writing and keep trying.