I'm not an expert on writing query letters, or on what agents want, but I am an expert on researching information. So I put together a bunch of information from different sources on how to write query letters. Most of the information below is sourced from one or more agents or authors; the original source is a click away. Some of the information comes from my own observations; I will try to be clear when my opinion comes into play.
Please note that this is very much centered on queries for novels. Much of the information can be adapted to non-fiction books or articles, but the basic nitty-gritty pieces are novel-centric.

Finally, I'm not claiming everything in here is absolutely THE WAY IT'S DONE. There are legitimate differences of opinion on some fine points, there are things that might matter to some people more than others, and sometimes the offbeat works (Ref 16MM). If you have some additional information that offers an alternate take, please post it and I'll incorporate it.

Writing a query letter (cover letter) is hard. It's a lot of work. It takes multiple rewrites. But it shouldn't be confusing. All those "rules" you've heard about query letters? There's a reason for every single rule. I'll try to take the mystery out of writing a good query letter by explaining what to do, and, more importantly, why you want to do it.

There's a lot of information here, so I've broken it down into sections which roughly correspond to sections you might write, or concepts you might include, in a query letter.
  • BACKGROUND: What to think about before you write your letter.
  • RULE NUMBER ONE: What the purpose of a query letter is.
  • THE BASICS: Format, length, and the overall look of your query letter.
  • GREETING/OPENING: How to say hello.
  • REQUIRED INFORMATION: The little facts you need to include.
  • PERSONALIZATION: Personalize your query letter for each agent.
  • HOOK or TAGLINE: Grab the agent's attention with one sentence.
  • MINI-SYNOPSIS or STORY SUMMARY: The hardest part: What's the story about?
  • BIOGRAPHY: A little about you.
  • MISCELLANEOUS: Some other things you might include, or not, as the mood strikes you.
  • CLOSING: End the letter.
  • WHAT NOT TO SAY: Things you don't want to include.
  • WRAP-UP: Some things to check after you've written your first draft.
  • REFERENCES: Don't believe me? Talk to these folks about it.
  • POSTSCRIPT: Or tell me about it.