How to grease a hub?
For a standard loose-bearing hub, to grease it you disassemble it, wash the components in solvent, and then reassemble with new grease.  You may want to take this opportunity to replace the individual balls in the assembly.

As to how often you may need to do this, it's a little bit of a wild guess.  I aim for (very roughly) every 10K miles, but a lot depends on conditions (and mine are commuting/touring).  If the bike is rarely exposed to rain and dust then longer is OK.  If it's regularly exposed to water/dirt then more often.

Some wheel bearings are advertised as "sealed", as they have a rubber seal that helps keep dirt out.  These can either be of the loose-bearing variety (which is serviced as above) or a cartridge (which cannot be serviced other that to replace it).  Sealed loose-ball bearings can probably go about twice as long before servicing.  Cartridge bearings you generally ride until they obviously need replacement.