Literary agents find publishers for their clients’ works; they negotiate the best deal possible when a sale is made; and they ensure that all payments due are made accurately and promptly, according to the terms of the contract which the writer and publisher have signed. Many agents will also help their writers revise their books before submission, but this is not always the case.
A good literary agent will also act as a buffer between author and publisher when required. When things go badly between an author and an editor a good literary agent will try to find a positive solution to the problems; when publishers make unreasonable demands, a good literary agent will do their best to convince them of the error of their ways.
Agents don’t take care of all these things because they enjoy wading into arguments and telling people off: they do it so that their writers will have more time to write, and will enjoy more productive relationships with their publishers and editors, which should result in more money for all involved—and a bigger, more loyal readership for the writers concerned.