Unless you're using a critique service, an agent is the first reader of your manuscript. Your agent will also represent you in any dealings with the publisher when problems arise. Besides being able to decipher royalty statements, for example, an agent can challenge inaccurate payments without damaging your relationship with your publisher. Agents handle all the little things that occur during the publishing process that you don't understand or don't have patience for. Once the book is published, an agent tracks royalty payments, makes additional sales on any rights the author has retained, and sometimes assists the publisher in marketing the book.
Agents are also useful in opening up new avenues for the writer's second book.
Many agents actually generate projects for their clients, by perceiving that an editor is looking for a particular type of book, and matching that editor up with his or her client. An agent can make you a better writer or illustrator. If your story has been turned down by 25 publishing houses, representation will not make the story more salable, or appear to be better than it is. Only your own hard work will improve your skills-and your chances of success. Strike two is that editors really don't have a prejudice against unrepresented authors.