You open your washer only to find that it's filled with wet clothing. If your washer is failing to drain, two things could happen: you could either get a washer filled with water (front loading), or your washer could actually give you an error and refuse to open (side loading). Either way, you're going to have to solve the problem.
Your Pipes Could Be Clogged
The first thing you should check is to make sure that the drainage pipe isn't clogged. Behind your washer is a hose that connects to your wall. Your hose could be experiencing drainage problems. Remove the hose entirely and then look through it. If it is blocked, you won't be able to see the light. Look into the wall as well. A blockage in the wall could be triggering an anti-flooding mechanism.
Your Trap Could Be Filled
Most washers have a trap that collects lint and other debris. Over time, this trap gets too full -- and then the washer may not be able to properly drain. Different models access their trap differently, so you might need to look in your washer's manual. You may need to take the face plate off of your washer in order to access it. Either way, you should put a bucket under the trap before undoing it. If water flows out once you undo the trap, then the trap was likely the problem. If the water remains, you may want to check the pipes that lead up to the trap for any blockages.
Your Pump Could Be Broken
Unfortunately, if the pipes aren't clogged and the trap isn't filled, then it's possible that the washer's pump is broken. That means it'll have to be replaced,usually by a professional. On the other hand, if you happen to be skilled at mechanics, you may want to order replacement washer parts yourself. You can usually find the right part by looking up your model number and call a retailer like Terry's Appliance Center to see if they have the part.
Most of the time your washer is failing to drain will simply be a problem with one of your hoses or your trap. Otherwise you may need to replace some parts. Either way it will be far less expensive than having to replace the washer altogether. By learning how to replace parts in your washer and troubleshoot your washer on your own, you can often save yourself a substantial amount of money.