One indicator is when the cassette stops freewheeling easily, or gets noisier or changes tone.
It’s a good question because a freehub body can get pretty dry and dirty before it gives any indications that it needs maintenance. Usually when the cogs are off for cleaning, I’ll give the freehub body a spin and check for any roughness etc. If it’s the kind of hub where the body is easily popped off, I’ll do that too and visually inspect the pawls and serrations. Heck if I’ve gotten that far, I’ll usually clean and lubricate the pawls. I’ll also stick a finger inside the freehub and try and spin each bearing individually to see if any are getting rough. Same with the bearings in the hub body, if it’s a hub with sealed cartridge bearings, and if the axle is easily removed.
There are exceptions to this protocol, especially for Shimano hubs. They are different beasts altogether. The freehubs aren’t (easily) serviceable, but the cup-and-cone axle bearings deserve periodic cleaning and regreasing. Shimano freehubs will probably be working just fine until our sun becomes a red giant.
Eric Nichols