In an unavoidable-accident scenario for autonomous cars, who are the victims at the moment the decision is made?
Nobody in particular — the identities of both the victims and the saved are still unknown when the programming is chosen, which is the decisive difference from a trolley case.
* The veil is the whole argument: neither victims nor beneficiaries are identifiable when the rule is chosen *
At the time the decision is taken — that is, when the programming is fixed — the identity of both victims and rescued is not yet determined. Two consequences follow, and they are what carry the argument.
First, a decision under uncertainty must be judged on what was known at the time. Moral assessment has to start from the knowledge available at the moment of decision and action, not from information that becomes accessible only afterwards. The illustration: a doctor prescribes, for a serious illness, the drug with the best prospects of success and the fewest side effects. He has acted in the patient's interest even if the patient turns out to belong to the small group for whom the drug does more harm than good. If a decision was rational at the moment it was taken, it remains rational forever.
Second, therefore, a programming aimed at minimising casualties can genuinely be in the interest of every single person — namely exactly when that programming reduces or minimises the risk of each individual. And that holds even for the unlucky person who is ultimately run over: at the moment of the decision, the rule lowered their expected risk too.
This is the fundamental difference from trolley cases, where the rescued and the sacrificed can be identified at the time of the decision. There, the choice to save the greatest number may still be the best one from a consequentialist point of view — but it is certainly not in the interest of the person who is sacrificed. In the autonomous-car case, it can be in everyone's.
Go deeper:
Wikipedia: Original position (veil of ignorance) — Rawls's device for exactly this move — judging a rule without knowing which side of it you will end up on.