What law determines where the money goes? Where would it go if there were no survivors to pay the benefit to?
The relevant law is encoded at 47 USC Ch. 7. The money doesn't "go" anywhere other than into the US Treasury. You are required by law to pay a percentage of earned income in the US forever. Independently, you might get an entitlement to draw benefits, depending on whether you are old enough (or are disabled or blind) and have enough "credits" (earned enough money). Certain people can receive money owing to your qualification (mnior children, spouse, dependent parent), see here. There is no individual balance, as there would be with an IRA or other savings plan.