I've not sued one (yet). Come close. Mostly I can talk my way through it or out of it. It really is a lot about setting expectations ahead of time before the work is agreed to be done. With mechanical work a lot can be unsaid and left out of a job, and legally in a suite you wouldn't have a leg to stand on.
I don't know what your situation was, but if you didn't specify and agree ahead of time on multiple paths and directions to go down and the mechanic handles it in a way you think isn't the right way, well you didn't cover that when you talked with them about the work being done.
It also helps to know exactly what you're willing to do with Plan A, B, C, D and more if needed and tell him what those items are.
Then I've had times where I went in for a transmission issue, but ended up being just a simple heater hose was leaking onto ignition wires and was causing an electrical issue and sputtering of the engine/transmission. I was completely wrong in my guess as to what was wrong, and it turns out nice that I only had to replace a $50 heater hose.
Where mechanics can fail sometimes is they say they can fix an issue (It's also expected that they can as they are a mechanic), and then do a bad job in the fix or fail completely. If they agree to do the job, it's now on them to make it work right, even if it turns out to be out of their ability to remedy. That may mean he needs to outsource the job and it should be on his dime. Some mechanics would disagree with me on that, but consumers expect that once you "Agree" to fix the issue, it is your responsibility to do so. This becomes an educational moment for the mechanic and improves his business as to what he can and can't fix. Cost of doing business. As a mechanic if you take on a job you're unsure of, and you don't state that up front to the consumer you are liable. Now if you did up front state, we're not sure how this will go. (Maybe it's an old part, or technology that no one knows how to fix any longer) by stating that up front the consumer then has to agree to let you "try" to fix the issue and will be paying you even if you cannot fix the issue. This is all because it was stated up front in the initial negotiation. At any time of the negotiation one side can accept or refuse, but in the end whatever you stated up front and he takes the car to do the work it's on them. If they failed in that duty or made it worse, it's on them to correct and you have a law suit on your hands that you could win.
If a mechanic goes out of his way to admit he may not be able to fix it and you are desparate and need him to try it anyway, you accept this in the initial negotiation, and say he fails to fix it, well, that was the risk you took when you still asked him to work on it. You have no case in such a situation and will lose.
Both sides have expectations, but barring that there is a legal precedent, and it really comes down to what was agreed upon initially when you talk to them about fixing the issue, and that's from both sides. There are times where customers think they are owed restitution from the mechanic, but not if they were up front about their abilities. If they say they can fix it and don't. They could renig and say later I can't fix this, and should only charge you the diagnostic fee it took to initially look it over, and eat the hourly cost because they told you they could fix it, spent 5 hours finding out they couldn't. You should not be charged those 5 hours just because, but only a small diagnostic fee because they did not come through for you when they said they could. And this happens at times and is honest, but consumers expect more at times and really shouldn't. I would be mad if a mechanic charged me 5 hours to tell me he couldn't fix it. That kind of behavior makes many mechanics dishonest and is a bad way to practice, and shouldn't be supported. Mechanics shouldn't tell you they can fix it, work on it for 5 hours and then charge you for those hours when it turns out they cannot. You as a mechanic have to be accurate in your assesment and back that claim up and not charge the customer for 5 hours for something you said you could fix. A small diagnostic charge would be acceptable to make the determination and information provided to the customer as to why it couldn't be fixed as you are giving him some new information that they did not have as to why it could not be fixed, and customers should pay for that even if it ended up that you could not fix it. The "Why" is what a diagnostic charge is for, and as a customer you should expect to be charged that, but not the full 5 hours. The mechanic couldn't do what he said he could do. (Again different if up front he says i don't know if I can fix this but could look into it for you, in this case you as the customer will eat the 5 hours because you didn't have the upper hand in the negotiation and accepted his work to "try" and fix it. The expectation that he "Can fix it" went out the window when he admitted he may not be able to.)
The reason both of these scenarios are acceptable on both sides is because sometimes customers are desparate and need a cheaper fix, or maybe has an old vehicle that modern mechanics don't understand, and there aren't any who really do, so it's a risk to the mechanic. If he stated it up front, and you accepted the risk as a customer, the mechanic is doing you a favor by even trying where others wouldn't and customers need to understand that. If we as customers don't accept those loses when we want mechanics to try, they will simply start refusing to even work with you. If you have such a car, they have the leverage if you really want that car running again.
I know this was long winded, but this is what I could call "Proper expectations" from the mechanic, and the customer and how they can work properly together. If this was followed, there really shouldn't ever be issues between the two.