The median American has $8,000 in their bank accounts. Most of the individual people buying insurance generally can't lose $N, because they have <$N - whatever amount the insurance claim is for is a number that they would never be able to pay, e.g. crashing your car into a semi-truck/lorry carrying a lot of expensive stuff or generating medical bills for people in other vehicles, or insurance for an ER visit that costs $800,000. Some individuals buy insurance for things they could pay, and just want to avoid the potential risk, but this is not the majority of people who buy insurance.
Both cases (lottery and insurance) are paying an affordable amount of money for a chance to avoid complete financial ruin.