The basic way to get an agent is to query them. That means to send out a blind letter (email these days) that introduces your book and hopefully piques their interest enough to make them want to read some sample pages. If they like the start of your book, they'll ask to read the whole thing. If they like that enough (or, more accurately, if they think they can sell it) they'll offer to represent you. The agent will then take it to editors at the publishers and try to find someone else who thinks it can sell and are willing to pay for it. It's actually a fairly simple flow and the agent is the first gatekeeper, so that's where we'll start.
There's lots of info out there on writing a good query letter, and some of the advice comes directly from agents themselves. I'm going to just summarize what I've learned in my research and then give out the techniques that worked for me. If you want to learn more about query letters in general, the best overall information I've found is at Absolute Write. In the Share Your Work section of the forum there's a group called Query Letter Hell. It's set up for people to post their query letters and get feedback, but before that there is a ton of information in the stickies (topics at the top of the forum). And you also learn about writing a query by critiquing others'; you see what works and what doesn't.
Here are the basics. A query letter is a summary of your story. It's about 250 words long. It doesn't have to tell everything that happens, but it needs to give an overall idea of who the main character is, what they want to achieve, and what the stakes are if they fail. It should read like a little story of it's own with the final ending a cliffhanger that makes the reader want to know more. Above all else, it needs to sell your work.
Some technical things: it's generally accepted to write a query in the present tense (makes it immediate) and the third person (makes it close), even if that's not how the book is written. If you have more than one Point of View character in your story, choose one and stick with it. You need to be specific (Not: 'she needs to know the truth', but 'if she doesn't learn who the murderer is she'll be next'). You can't get bogged down in details (Not: 'the murderer killed Bob and Sue, but Carolyn doesn't know Sue is dead, only that she's missing, and there's also uncertainty if Bob might have committed suicide, so Carolyn believes there's a murderer but not everyone else does.') You want to show off your writing while still sticking to a tightly driven storyline that is clear to someone who hasn't read your book yet. It's a whole lot to fit in and it takes a while to get it right.
A lot of people think a query should read like the back cover copy on a book. This is old advice (though you still see it out there) and I think it's more harmful than helpful. There is some overlap, and good query letter material can make good back-cover copy. But the back cover is there to tease, to tell what type of story the book is. The query shouldn't tease the agent - it needs to lay out the whole story (just not the final outcome) and it needs to say what this story is. You really need to lay out what makes your book different than everything else out there. If you hold back your big plot twist in the query (or big revelation, or big whatever) you're not showing the main selling point for your book. So write the query as a query and you might be able to pick out some good lines to use on a back cover one day. Though that's putting the cart before the horse.
So a query letter is a summary of your story, presented in such a way that it's a compelling read. It gives enough detail to show who your character is (their voice) and generally what happens to them. It should make the reader want to know how it ends because they understand the final conflict. It should highlight what makes your story special. Here's what I've come up with for mine, hopefully it does all that :).
Sixteen-year-old Emily Brayden is finally on an actual date with Holden James when grim-faced government agents arrive to arrest her. Fear and confusion turn to mind-completely-blown when Holden fights off the agents with superhuman strength, scoops her up, and jumps off a second story balcony to escape.
He claims they’re all aliens—him, the agents, even Emily. A race of ageless beings living on Earth since ancient Greece. The agents represent a faction that has manipulated humans for millennia and Emily is the first half-breed, the key to save their dying race. Delusional fantasies much? But when the agents kidnap her mom and blow up Holden’s house, he’s all she’s got.
Full of doubt and adrenaline, Emily desperately follows Holden as he leads their getaway. It’s kinda hard to deny the growing strength that lets her jump from speeding trains and sprint for days. After a fall from the Golden Gate Bridge, Emily discovers a mental toughness to match the physical and saves an unconscious Holden. It’s all true. She is extraordinary, she needs Holden—and she wants her mom back, dammit.
Knowing they need help, they track down a group of ancient aliens who’ve fought the agents for eons. The real life Achilles will lead the raid to liberate her mom using alien flying suits. Surreal. But Emily’s going too. To free her mom, Emily will walk—fly—into the government facility that’s headquarters for those who want to lock her up like a lab rat. Or worse, dissect her like one.
In Part 2 I give some specific techniques that helped me as I wrote this query. Part 3 will be general tips that should help anyone working on any type of query.