Our KitchenAid heavy duty top-loading washer stopped with a full tub of soapy water and laundry just before the rinse and spin cycle. It would not initiate rinse and spin on any setting. This was a pretty clear indication of a failed lid safety switch that prevents these cycles when the lid is open. I temporarily bypassed the switch with a jumper that did not damage the connector to get the in-process load finished and ordered a factory replacement part from AppliancePartsPros.com. Paid a little more for the factory part, but decided it was not worth the possible aggravation if a cheap part was either DOA or did not have staying power. It came promptly even using standard shipping (about 2.5 days after the order was submitted).
Then, it was a fairly simple process of again opening the compartment containing the controls and the electronics, removing the cabinet which includes the lid, carefully removing the old switch assembly and replacing it with the new one. One caution: Be sure to keep the screws associated with the old assembly. This part does not come with replacement screws, so the old ones need to be reused for mounting the switch and reattaching the ground wire to the cabinet (3 screws total). I found it easier to install the switch assembly while the cabinet was laying on its side on the floor. Some recommend installing it once the cabinet is standing vertically. Take your pick.
The whole process took a little less than 30 minutes including testing the switch before buttoning everything up. If you are moderately handy, this repair should not be difficult. It was helpful to have a small maglight due to the lack of good lighting in our laundry room. There are some helpful YouTube videos showing how to replace a typical Lid Switch Assembly. It is worth watching one or two of these to get a sense of what is involved.