The former makes the latter more likely. A good agent will:
* get a better advance for the author, which makes it more likely the book will actually get finished
* be on the author's case to get the book finished and out (otherwise less money for them).
* negotiate better promotion with the publishers
* be on the publishers case to make sure that what was agreed actually happens
* etc. etc.
All of which make it more likely that the book gets published, gets promoted, and so seen, and so read, and for that word-of-mouth to kick off ;-)
As for the number of successful authors who were rejected. That's to be expected. Publishers are the VCs of the book industry. They say "no" a lot, and most of the people they say "yes" to aren't hugely successful. Every VC has said no to a successful company. Every publisher has said no to a successful author. They doesn't mean either group are necessarily failing as a whole.
To push the analogy - not everybody needs a VC. Some people can bootstrap. Some people are happy taking on the extra load of marketing, financing, producing, distributing, advertising, editing, admin, etc. etc. They find it fun and interesting and are happy to take the time to do it. Some market segments make that work considerably less than others do.
Other authors want to use that time to write.