I'd love to say "Just trust me," and leave it at that, but if you want to be published the traditional way - by a publishing house - these days, you MUST...HAVE...AN AGENT.
Because 99.9% of the time an editor or a publisher won't touch you unless you do. They don't have the desire or the time to slog through the output of thousands of different people; they want to turn to an agent they trust who they know will give them their best, meaning your best.
Agents won't query editors unless they know your work is the best it can be, but they can recognize the difference between a hack and a gifted writer who needs a bit of polishing. Once your work is up to par - and they'll help you get it there, because their paycheck is depending on it! - they'll start querying editors.
And they'll get your work read by the RIGHT editors. It's their business to know which editor at which publisher prefers what. They have endless connections built on years of networking and study, and can get even the worst writer read by the right person simply because they're a respected agent. Wouldn't it be nice to have someone like that on your side?
Plus, it is their business to know the business side of books. They tackle the fine print. They get you the most money they can for your work because it directly affects their bottom line. Now THAT'S motivation. They can also serve as an intermediary between you and the publisher, not only where money is concerned, but rights and options and general un-pleasantries. Problem with an editor? They handle it, leaving you to talk to the editor about editorial stuff. They'll be your bad guy. And they'll be there for you if you get dropped, too, believing in your talent and bolstering you if you don't sell well.
In short, if you want to be (traditionally) published, GET AN AGENT. If you want to get an agent, write an AWESOME query letter. And if you want to write an awesome query letter, check out my next post in a day or so, or (for the long version) check out Noah Lukeman's free e-book on How to Write a Great Query Letter. Good stuff, people. Now go get an agent.