A washer that agitates but won't spin has a few likely causes, and the fix path depends on machine type.
On top-loaders: first check the lid switch. If the switch fails or the actuator is worn, the control board thinks the lid is open and disables spin. Second, inspect the drive belt. Worn, glazed, or snapped belts are a fast and inexpensive repair. On older Whirlpool direct-drive top-loaders, a failed motor coupling is the most common no-spin cause — a $30 part, typically a one-hour repair.
On front-loaders: the door lock is the first suspect. Front-load washers will not spin without confirming the door-lock assembly is engaged. If the lock has failed, the control board reports a door-open error and skips spin. Bearing failure is the second common cause on front-loaders five-plus years old, especially if the machine vibrates hard or makes a growling sound during spin.
Heavy loads out of balance will also suppress spin on many modern machines by design. Re-distribute the load, restart the cycle, and see if the problem recurs before escalating to service.