I think a significant number of people at least enter into the agreement thinking it's a feature. Roughly:
- Going to the gym sucks, and I don't want to go
- I should force myself to go to the gym anyway
- Gyms are expensive, and hard to cancel
- The pain and shame of canceling, combined with ongoing cost, will be a motivator for me to actually go to the gym
In short, I think a lot of people erroneously believe that locking themselves into the contract will motivate them. Instead, they end up still not going and also paying because of the contract.