You called?

I love that you're asking these questions and sharing them here, so everyone can learn. These are the kind of discussions we should be having here.
As a publisher/professional editor, and an author who is self-published, I can verify what Varon said. Whether you submit directly to the publishers or go through an agent, the process is largely the same. Researching whether or not an agent or publisher is looking for what you've written is a big part of the process that a lot of authors miss. Publishers have specific requirements, and agents have areas they specialize in. You can write a brilliant sci-fi novel, but if the agent doesn't do sci-fi, you won't get anywhere. It's also important to pay very close attention to any requirements the publisher or agent may set out--font size, what to include in your pitch, etc. If you don't follow those, it looks like you can't read directions (or think the directions are beneath you), and they will reject you without reading the manuscript.
The process will take a lot of time. A lot of agents or publishers allow up to six months or more to reply to your query. If you're doing exclusive submission (only submitting to one agent or publisher at a time), then your manuscript will be stuck until they respond. And, of course, you're probably looking at submitting to dozens upon dozens of publishers and agents. Regarding J. K. Rowling, she submitted to and was rejected by several major houses before she finally got accepted. If you can handle rejection, and are willing to put in the work, you can get picked up.
Of course, getting published is no guarantee of success, and there will likely be a lot of promotional work that is still the author's responsibility. In all honesty, self-publishing and traditional publishing take about the same amount of work for about the same chance of return. It just depends on what your dream is, and what kind of person you are, and which challenge is better for you and your book.
However, regarding editors--no matter which route you take your book, you need to do everything in your power to make your book the very best it can be
before you submit it. That includes having beta-readers and editors--including a really solid proofread for grammar and typos. The publisher has in-house editors to do final proofreads and/or any editing changes they dictate, but that's only if they love your work enough to pick it up. Publishers and agents aren't your editor. They are not there to help you get your book ready for publication, and most agents will be offended if you send them a manuscript that's not ready and expect them to make it ready. When you pitch, you are selling a product. You are trying to convince them that they want your product because it's a good product that will make them money. Hence, that product needs to be brilliant.
So yes, you definitely need to thoroughly edit your book. However, there is a vast price range in editors, and oftentimes you can get help from friends. It doesn't have to cost triple digits. But you need to be harsh on your work, and you need several readers/editors who will be harsh on your work, to make sure it's worth publishing before you attempt to pitch it. (Which means, if you do use free labor from friends, make sure they are either skilled writers, or someone who is not afraid to tell you the truth.)
If you decide to go the self-publishing route, thanks to very accessible services like CreateSpace, it is very easy to get a book out on all the major channels, including Amazon and the Ingram catalog that libraries and bookstores buy from. The trouble is convincing people and bookstores to buy the book. The hardest part of self-publishing is promotion. It takes a lot of time, and sometimes a lot of money. You will still have to do promotion work if you get picked up by a major publisher, but it might not cost you so much out of pocket, and there will be some assistance offered by the publisher. With self-publishing, you have no name and no publishing label to give you any clout, so you have to start from the ground up and build your own audience.