After the wash cycle ends and before the spin cycle starts, the water should drain from the washer. If water remains, first check for a kink or clog in the drain hose, a backup in the house drain system or in a drain hose lower than the water level in the drain tub. If the drain path is clear, the drain pump might have failed or the water-level pressure switch might not sense how much water is in the washer.
In a top-load washer, a failed lid switch can keep the washer from advancing to the drain and spin cycle. A failed timer or problem with the drive motor can also prevent a top-load washer from draining and spinning. On a front-load washer, a bad main electronic control board or failed motor control board can prevent the washer from draining and spinning.
Many washers won't spin if they're not level, so performing preventive maintenance checks that include leveling the washer may help you get your washer draining and spinning.
If you have a top-load washer, this video has additional troubleshooting tips to get your washer draining and spinning again.
Cleaning a clogged drain pump filter on on a front-load washer without a drain pump access door often gets the machine draining and spinning again.