The first thing you have to do is ask for the form from the plan administrator. If its a 401(k) your company HR department should have it. As these assets may be a significant part of your estate, be sure the decisions you make fit with your overall estate plan.
Spouse as primary beneficiary
A surviving spouse has the ability to do what is known as a "spousal rollover" to his or her own plan. This means the survivor does not pay taxes until mandatory (at age 70 1/2) or voluntary distribution of the asset. Other beneficiaries inherit these assets on less favorable terms. Many estate plans can be designed to eliminate the inequity that may result in the surviving spouse taking the entire asset. This is of special concern in second marriage situations.
Tax considerations should not override what you may otherwise consider to be a just distribution of your assets. However you cannot ignore taxes either.
Trust as beneficiary
Most trusts, including most revocable living trusts, should not be named as beneficiaries of qualified plans unless you are comfortable with the tax treatment they will recive. Most Trusts are taxed based on the "five year rule" which means the entire contents of the Trust will be subject to income tax within 5 years of death. An Attorney may however design a Trust that cases a "stretch" of benefits as well as provide additional asset protection benefits. If you have such a trust, name this trust as the beneficiary.
Note the rules are different for the "Roth IRA."
Caution on certain types of beneficiaries
You should consider that outright distribution of these assets to heirs on public benefits may cause substantial disruption. You should consider naming a trust with "special needs" provisions if you have one. Similarly, you should consider the problems that may come with naming a drug addicted or heavily indebted beneficiary.
As distributions from Roth IRA plans are tax free, you should consider naming a Revocable Trust as a beneficiary.