The most common cause of the problem you just described is a lid switch malfunction or lid strike (actuator) problem. Symptoms may include, filling and stopping on the intial fill cycle, stopping right after the wash cycle, not advancing to rinse or spin cycles, and a wash tub that will not drain.
NOTE: If the washer works intermittently by shaking it, it sounds like you have a loose or broken switch.
The lid switch is usually mounted under the washer top casing, on the right hand side on most top load models. It is activated by a plastic piece on the lid (called a "Lid Strike" or "Actuator") through a small hole on the rim of the wash tub opening. In many cases the lid strike breaks off the lid, or the lid switch becomes loose and no longer makes contact. Inspect the lid to make sure the lid strike is still intact, and then inspect the mounting screws (adjacent to the small opening on the wash tub rim) and make sure they are snug. If you determine the switch to be defective, the following link explains how to replace one:http://www.fixya.com/support/r3557193-replacing_a_lid_switch
On some models, the lid switch is located under the top casing by one of the lid hinges. You will know if you if you have this type of switch, because it does NOT have a lid strike (actuator) and the small hole on the right hand side of the wash tub will not be present. This type of switch is actuated (toggled) by a rod on the lid hinge. With this type of switch, if you locate it and it can be toggled by hand, you may only need to adjust the actuator rod by bending it slightly.
NOTE: You do not have to drain or bail the water from the washer tub to perform this repair. Once a defective lid switch is replaced, the washer should drain normally.
Replacement parts (if required) can be purchased at any of the following web sites:
The average price of a replacement lid switch for this model washer is about $15 - $20 if you perform the repair yourself. Prices will vary between sites so shop and compare. If you have questions, or need additional assistance, please post back and let me know. This is a very simple repair that you can easily perform without the assistance of a repairman.
NOTE: Whirlpool manufactured washers have a self-leveling assembly for the rear feet that can become unleveled if the washer is shaken violently. The process to re-level the washer is simple. The following link explains how:
If this advice does not help you enough, repairclinic.com has a Repair Manual you can order to assist you with all your repairs. The part number is 1170635 and is priced at about $20.
Searspartsdirect.com also has a repair manual for about the same price. Part number 4314044L. I hope this information is helpful to you.