The lottery is a way to assign disproportionate rewards (or punishments) fairly. Procedural fairness—equal chance of selection—provides legitimacy to this system of disproportionate allocation.
Given the purpose of a lottery is unequal allocation, it is important that informed consent is sought from the participants, and that it is only used in important areas when necessary.
Fairness over the longer term
One particular use of lottery is in the fair assignment of scarce indivisible resources. For example, think of a good school with only hundred open seats that receives a thousand applications from candidates who are indistinguishable (or only weakly distinguishable)—given limitations of the data —from each other in matters of ability. One fair way of assigning seats would be to do it randomly.
One may choose to consider the matter closed at this point. However, this means making peace with disproportional outcomes. Alternatives to this option exist. For example, one may ask the winners of the lottery to give back to those who didn’t win, say by sharing the portion of their income attributable to going to a good school, or by producing public goods, or by some other mutually agreed mechanism.
Random selection is a fair method of selection over objects where we have no or little reason to prefer one over the other. When objects are observably—as much as the data can tell us—the same, or similar, same within some margin, random selection can be seen as fair.
One may extend it to objects that are different but for no discretionary action of theirs, say people with physical or mental disabilities, though competing concerns, such as lower efficiency etc., exist. More generally, selection based on some commonly agreed metric, for instance, maximal increase in the public good, may also be considered fair.
As is clear, those who aren’t selected don’t deserve less, and indeed adequate compensation ought to be the formal basis of selection, unless of course rewards once earned cannot be transferred (say lottery to get a liver transplant, which leaves others dead, and hence unable to receive any compensation, though one can imagine rewards being transferred to relatives, etc.).