Note there’s a difference between a pension and an annuity and what happens for each.
pension = paying money in.
annuity = money pays out to you normally post age-55.
With a pension, there are normally terms and conditions around what happens if you die. Usually along the lines of a ‘death in service’ benefit, which would pay out a lump sum to your estate. Your will (or intestate rules if you haven’t made a will) would dictate who gets the money. Some pensions will specify that they’ll pay a certain amount of lump sum rather than it relating to how much you have saved up in your pot. Check with your pension provider to confirm what the terms are, and make sure you’ve told them who your dependents/beneficiaries are. Sometimes the trustee of the pension scheme will get final say about how much is paid to whom, but your preferences are usually taken into account.
When you reach retirement age you normally have to choose to buy an annuity with your pension pot money (if you want to - there are other options like getting a taxable lump sum). When you buy an annuity, you get to specify what terms you want after you die, such as adding a guarantee period (where a lump sum or regular payments would be paid to your estate if you were to die within that term), or spouses benefits (eg 50% or 100% paid to your spouse after you die for the rest of their life). All of those choices come at a cost - ie if you choose a 100% spouse’s benefit, you’ll get lower annuity payments during your lifetime than if you were to choose no spouse’s benefit. So when you make your annuity choices, choose very carefully, read all the literature your pension provider sends you, shop around to get the best rates and if in any doubt pay for independent financial advice - it’s worth the money.
Above mainly applies to defined contribution pensions. Defined benefit pensions tend to be more tightly controlled by the conditions agreed between the employer and pension provider, so you might have less choices.
HTH