The first step to getting your book published is to have a finished product with a synopsis, outline and other information that a prospective agent might want. Publishers tend to not deal directly with writers, instead working with an agent and later an editor. Therefore, after you get your book written, you need to look for an agent. With the advent of self-publishing, some people bypass the editor and agent, but traditional publishing requires both.
Look for books in the genre of your work and contact the publishing department to find out who represented the author, if such information is available. It's best to compile a list of five to ten agents. Compose a query letter for each one, but do not send any unsolicited documents. Give a brief introduction along with a small overview of your prospective project. If the agent wants to represent you, he should contact you when time permits. This could take weeks or months.
After speaking to the agent, you can determine whether to pursue a working relationship; for example, finding out what type of fee the agent takes from book royalties or how many publishers he plans to query on your behalf. Be sure to draft a written contract to protect as many of your rights as possible.