Motors and controllers

I have to replace a motor in an older cart. I know the speed controller and the solinod have to match but does the motor as well? I no the spines have to sync with the rear but do they match the motor as well? Did anyone write a book on the yet?