The better pads have "Wear Line" and a line stamped or printed onto the tops, which removes some of the guess work. When the line's gone, replace them. Otherwise, with old-fashioned blocks, they used to need replacing when the grooves had worn away on either edge. Under no circumstances let any part of the pad wear away completely, as that will leave any metal holding the pad into the block grinding into your wheel rim, shortening its life rapidly.
Replacement depends on the type. Basically, cartridge/holder pads usually need a bolt on the outside of the shoe undoing, the old pad pulling out and the new one pushing in. One-piece blocks are removed and new ones fitted. I thoroughly recommend switching to the less wasteful cartridge/holder pads if they're not already fitted. Detailed instructions on fitting and setup can be found on
www.sheldonbrown.com and
www.parktool.com among many others. There are lots of types of brakes!