> Maybe the legal system is structured such that all 20 million citizens can band together and sue all 10,000 factories simultaneously.

Yes, this is the scenario that would occur. It's obvious, in retrospect, you've debated this before. ;)

Are you familiar with the concept of DROs? I would need to introduce the concept of Dispute Resolution Organizations and Polycentric Law in order to explain this fully, which I am afraid would take far too long. The gist is that, due to many advantages I will skip over here, people would subscribe to DROs (like they do today for life insurance) which would mediate disputes through negotiation with a view to establishing new contracts that will repair the initial damage that is under scrutiny. People would choose DROs based on the promises and rules that DROs make and abide by when they sign their contracts with those they represent, and based on the process they have for negotiating and establishing new rules, and also their tie-breaking process.

There would be DROs for people in general, DROs for specialized trades (like medical doctors and engineers due to different liabilities), and of course DROs for companies.

If several companies are polluting the air in a given city full of people, and those people want to sue those companies for their smog having caused them bodily harm (under tort law, since your body is your property), then they could notify their DROs of their intent; those DROs already talk to each other on a consistent basis since that is how disputes are solved between people that belong to different DROs, so they already have rules amongst themselves for how to deal with lawsuits that are many-to-many in relationship, as it were. Upon asked to effectuate this plural lawsuit, the DROs representing both plural parties would engage in negotiation amongst themselves on behalf of their clients and would need to find a solution that would make most of their clients happy. Here we have the DROs interests perfectly aligned with the interests of those they represent, because if the DRO makes an unpopular decision, it will lose clients.

> This works, but all you've done is reinvent something identical to modern environmental regulations

Yes, but now without the coercion that is sine-qua-non to regulations. That means a huge decrease in the initiation of violence among people.

> And this is a relatively simple example.

It is, and I hope my sketch-answer above has enough information to inform you that there are very good and well-fleshed-out solutions to this problem as discovered by the philosophers that explore this field. Nozick is particularly good at taking readers through complicated examples of real-life situations that at first seem hard or impossible to solve with a free market.

> How would this deal with, for example, atmospheric mercury pollution that has already caused seafood to be dangerously toxic to children and pregnant women if eaten in large quantities? How would it deal with greenhouse gas pollution which won't cause any catastrophic effects for decades?

I do not know if there are proposed solutions for those issues where there is a large delay between cause and effect. Here I am speaking from my own head and not remembering things I've read as I was above for the DRO answer: I would guess that for the first case, where a present issue was caused by something/someone(s) in a hazy past, that the tortfeasor may be impossible to track down to engage the plaintiffs. If the tortfeasor companies are still around and haven't engaged in this issue before, and proof can be established to link cause and effect to them, I imagine it could be treated as a normal lawsuit from here on (having identified both parties in the suit); their representative DROs will have to negotiate and come up with a solution that is satisfying for all parties involved; if rectification is impossible, then perhaps reparations would be in order. If there is a known method for fish-mercury removal (or the like), then depending on the pressure put on the DROs by their clients, the resolution could include the company having to pay to employ this solution, even though the person who was responsible for the mercury leak (let's suppose) might be long gone.

As for the greenhouse problem where the cause is in the present and the effect is in a hazy future, the DROs would first expect good evidence that there is indeed a cause of something going on, and sufficient evidence that this cause will result in a definable effect. Having established as much, there may be grounds for a lawsuit under threat of violence (threats of violence are considered initiation of violence by most philosophers in this area) since the noxious gases being dispersed now are threatening the lives of children and infant (we can't use "future generations") in the future, just like a threat to kill someone works.

This has been very enjoyable, and I hope you can take something away from this. Most free marketers I meet are well read and reached their conclusions from carefully reading the extremely counter-intuitive stuff that Nozick et alii put forth, or whoever else is their favorite Jew, since most of the best free market philosophers have been Jews for some reason [1] (my guess: high verbal intelligence coupled with propensity towards radicalization and high self-confidence and courage, or as they call it, chutzpah) and I feel like mentioning it because I owe my education largely to them (as an autodidact in economics), even though I am a harsh critic of their version of WW2 history (critiques which are purely based on science (especially chemical analysis) and not on any form of bigotry as many are quick to suggest).

[1] The current best jewish free marketer philosopher is unbeatably Walter Block. You owe it to yourself to listen to some of his arguments; you will undoubtedly catch a glimpse of the whole free market machinery at work through his astoundingly clear explanations. No one comes close. His defense of slander and libel are among my favorites - students that at first disagree with him are left speechless after having their contentions undone by Block.