Life insurance is a way to provide peace of mind and protect and provide for the insured's family when they pass away. The policy can help pay for funeral expenses, a child's college fund, replace spousal income for a time, as well as handle any debts and estate taxes (for an alternative, see A Look at Burial Insurance).
Given all this, most insureds will name a spouse or child as the primary beneficiary on their life insurance policy. They might also include a next of kin as a contingent or secondary beneficiary. The contingent beneficiary is the one who will receive the life insurance payment if the primary beneficiary has died by the time the insurance is paid out (find out How to Collect a Life Insurance Payout).
In the unlikely and unfortunate event that no beneficiary has been named or all beneficiaries have died, the insurance company will pay the money into the estate of the deceased, so that it will be managed alongside all of their other assets (such as cars, bank accounts, jewelry, and business interests).
When they become estate assets, the life insurance payment will go through probate and be handled by the courts according to the laws of the jurisdiction.
The most likely outcome is that an executor will be named and they will be charged with distributing the assets according to the deceased's will, including the life insurance benefit. If there is no will, most jurisdictions have intestacy laws that dictate who will be the recipient of the property. Usually, this involves going down the chain from the closest to the furthest relative until someone is found (find out What You Should Include in Your Will).
In the very rare event that no beneficiary can be located, the estate will go to the government.