I own a self-publishing company and I'm a self-publishing author, so keep in mind that most of the time I will encourage authors to self-publish instead of focusing on traditional publishing. I teamed up with a literary agent years ago (for about 6 months). At that time I wanted to get a traditional publishing deal for Unconventional. It didn't happen and I decided to self-pub instead. I have no regrets.
I'm aware that some authors would rather not self-publish, though -- for various reasons. Most of the time it's a money issue for those authors. They lack the funds to invest in their book(s). I get it. When a budding author calls or emails me and admits he/she has no money, I usually point that person toward traditional publishing. I also explain that most traditional publishers do not accept unsolicited materials, therefore it's a good idea to connect with a literary agent. An agent will pitch the book to traditional publishers and retain 15 - 20% IF a deal is reached with a publisher. It's extremely difficult but not impossible to get a book published traditionally.
To work with a literary agent, an author usually has to query many agents (i.e. send out query letters) and brace himself/herself for rejection. I think I read somewhere (long ago) that literary agents accept somewhere around 1% (or less) of the authors that send them query letters ... Even if the author's book is great, it still might attract many rejections because perhaps it's too unique and doesn't perfectly fit into any particular category; maybe the query letter is lacking something; etc. Nathan Bransford, a former literary agent, does a fantastic job explaining the querying process, and he even has a post entitled "How To Find A Literary Agent," which is extremely helpful for authors who want to go the traditional route.