A bad ground can cause all sorts of strange things to happen. I would guess if the ground is the problem, you ave another bad connector upstream of the fan.
If you have a wire long enough to get to a good ground, that's a good place to start. If that is the problem, then trace the circuit to the next fixture and check the connections. Go all the way to the panel if you can, or to a fixture on the circuit that is working.
When I was a kid I was going nowhere fast, now I'm an old man I'm going everywhere slow.