If a poor person gets run over by a bus, an attorney might take that case because they might be able to recover part of the damage award as attorney fees.
Attorneys take certain cases because they know there is an opportunity to be paid later.