Almost never. The whole "companies have to maximise shareholder value or the board will get sued" thing isn't really true.
Shareholders get to vote for the board and they have a broad range of statutory protections that ensure company accounts are audited, compensation arrangements are disclosed, etc. But as far as a general right to make money? Nope. You'd only have a chance with that kind of lawsuit if the board made an obvious, colossal blunder that should have been obvious to anyone at the time.
> scam law firms ran on people emotional about losing money in the market.
No, it's a scam they run to get a class-action settlement and protection from any other similar (possibly meritorious) lawsuits, regardless of who loses money in the market. Every major decision (such as a merger) by a company, is met by an ambulance-chase race to file class actions with boilerplate charges. Check the financial news ~7 days after any public-company acquisition happens for the near-duplicate stories with differing law firm names.
They always cost money. I've been on a couple of boards and it is always advised that board members carry personal insurance against it as well. These suits often name board members and officers personally, in addition to the company. So whether or not it would prevail the incentive is to not have them start.