I never had to. Mine has been running for 10 years and about 10,000 miles . I had some Xiongda 2-spped motors that needed greasing immediately, but they're a bit special. I've had to service other people's motors that had let in water, mainly because the wheel was put in upside down, and a couple more with cable damage. I've seen a batch of Bafang motors that weren't shimmed properly, so there was sideways pressure on the bearings that would result in premature wear. You could feel the tightness when trying to spin the wheel.
In summary, I'd say that any hub-motor should last a lifetime as long as you don't let water in. The rust does more damage than anything. You only need to open one if it's making a rumbling sound. The course grinding sound is always an external electrical problem, except when a hall sensor fails.