The most common cause of the symptoms you describe is a lid switch malfunction.
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") 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 and the small hole on the right hand side of the wash tub will not be present. This 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 by bending it slightly.
A replacement lid switch (if required) can be purchased at any of the following web sites:
The average price is about $20 - $30. Prices differ between sites so shop and compare.
If you have questions, need additional assistance, please post back with your model number (located on a nameplate along the wash tub opening under the washer lid), so I can provide you with better assistance. I hope this helps you.