The general theme is a bit like a dynamo hub, but bigger and more electrically complicated: the middle of the hub contains a ring of coils (and probably also some electronics) which are stationary, fixed to the axle. The shell has a ring of magnets which move past the coils. (There may be additional mechanical complexity, if the motor is geared rather than direct-drive.) Cables enter through the hollow axle, emerge from a hole in the middle and connect to the electrickery on the stationary bit.
Depending on how the system operates, the cable may be carrying DC voles straight from the battery and some control signal to tell the hub what to do; three-phase power to the coils from an external motor controller; or three-phase power to the coils plus a Hall-sensor signal to tell the controller what position the magnets are in at any given time. As you can imagine, breaking most of these connections will stop the hub working properly, but shorting some of them out will have the added fun feature of blowing fuses and/or releasing the magic smoke from important semiconductors, leaving extra faults in either the hub or external controller to diagnose beyond the original cable damage.
Replacing the wiring will be a case of opening the hub, disconnecting the existing cable and re-making the connections (may be soldered, may be some wire-to-board connector you may or may not be able to identify when you get a look at it) with a new one. If there's a proprietary connector on the end that dangles free from the axle, you have to track that down, too, or bodge in a suitable alternative. And reassemble it in a waterproof way.