Depends on the field you're writing in. If you're writing sf or fantasy, an
agent is not needed at first. In fact, the kind of agent you can get before your
first offer from a publisher is not the kind of agent you want afterward, as a
general rule. So for sf and fantasy, you create a query package:

1. "The Partial": The first two or three chapters, or however many it
takes to create a package of about thirty or forty pages. This shows that you
know how to write and that the novel begins well (and believe me, that's the
place where all impossible novels fail).

2. "The Outline": A present-tense synopsis, with no scenes or dialogue, of
the remainder of the story, starting immediately after the end of the partial and
going completely to the end of the ms. This shows that you know the whole
story and that it's a good one.

3. "The Query Letter": This letter goes on top of the partial and outline,
and it contains the following: "Enclosed are the first [X] chapters and a synopsis
of my [hard sf/heroic fantasy/etc.] novel [Title of Manuscript]. Would you like to
see the complete manuscript?" Nothing more needs to be said, unless you have
sold a story or two to a professional magazine. If you have not sold any stories
within the genre to a professional publication, then say nothing at all about your
credentials or experience as a writer. They will want to get acquainted with you
after the sale, not before reading the manuscript. You don't have to tell them
you're new -- they know they've never heard of you.

Send this query package to all the sf publishers or fantasy publishers.
Because it's a query -- i.e., you're not offering the book for sale, you're inquiring
as to whether they want to see the whole manuscript -- you can query all of
them at once. When the first one writes back asking to see the whole thing,
wait for another week or two before sending it. If they phone, then they're eager
-- so you send it. Otherwise, you wait to see if another publisher that you prefer
asks to see it. Because when you send the complete manuscript, you send it to
only one publisher at a time. Period. You never violate this rule without
informing both publishers, and you can only do that when you're an established
author and your agent is preparing for an auction.

When you get a contract offer -- the actual paper is sitting in front of you
-- then you need an agent. Don't sign the contract. All contracts ask for rights
that you and your agent can hold onto and exploit much better than the
publisher can. The agent will certainly not be able to get you more money for
your first novel, or a higher royalty rate. Forget what you've heard about those
miraculous million-dollar first sales. What your new agent can do is hold onto
your foreign and film rights and then work hard at selling the foreign rights.
Half my income comes from foreign sales of my work.

How do you get an agent? Send a query letter to a whole bunch of
reputable agents saying, "[Publisher X] has just offered me a contract for my first
[science fiction/fantasy/etc.] novel, [Title]. I feel that I need representation.
Would you like to see my manuscript?"

Again, this is a query, not a proposal. At this point, since you have
already made the first sale, it is not at all unfair for you to insist on 10 percent
commission, period, even though almost all agents claim 15% these days. Since
that 15% is supposed to defray the costs of looking at the slushpile, and your ms.
is already sold, you are in a very strong position to ask for this. See what their
reaction is. You may end up going with a fifteen-percenter, or settling for 12%
-- but you'll find out right away which agents regard you as their employee, or
think they're going to be your manager, or are angry, testy people that you don't
want to work with. Think of it this way: By seeing how they negotiate with
you, you'll see how they negotiate with publishers -- their style, etc. Bully?
Whiner? Liar? Or honest, forthright laying out of positions?

If you're in another genre, however, then those query packages have to go
to agents, not publishers, and you have no hope of anything but 15%. When
you sign with an agency, do not agree to a fixed term or a contract that does not
specify a means of ending a relationship immediately upon notification. If you
dismiss your agent, they are entitled to continue to collect their percentage on
any contracts they negotiated; but there should be no nonsense of being stuck
with an agent that you're not happy with. If you're not getting good
representation, you should not have to endure it for one minute longer; if you
are getting good representation, there is no reason to have a fixed term on a
relationship that clearly will last for years. In every case, you are the sole
determiner of whether you like the representation you are getting. And if you do
find yourself deciding on a fixed term, make it for no longer than one year. This
is essential. I have spent too much time helping too many writers get out of bad
agency relationships; it is better to have no agent than a bad one.