As a back-of-the-envelope approximation, if the commission is 6%, and there's at least a 6% chance that having a real estate agent keeps me from doing something stupid on the largest financial transaction I will do in my life, it's worth it. Probably, they do nothing for me I couldn't have done myself, but there is that chance that I would have (for example) bought a house in an area where it could flood, and then not be able to sell it because of that fact.
There may be real estate agents that are not good enough to be doing the job, but a competent one is absolutely worth it for a person who does maybe 1 or 2 house transactions in their lifetime, just for the chance that they might make a really bad decision if they don't have someone experienced to help them think through it.