Many types of electrical appliances, such as washing machines, are housed in a metal shell or cabinet. If the internal electrical insulation in the appliance fails, the appliance can leak voltage to the metal cabinet, energizing it at levels sufficient to give you a nasty shock if you touch the cabinet. To prevent this, appliance makers connect the metal case of the appliance to a building grounding system via a three-pronged plug connected to a grounded outlet.
The grounding wire normally isn't part of the path electricity takes through the appliance. When everything is in order, electricity travels from the "hot" or energized wire through the motor, electronics or heat element that does the appliance's work and then proceeds to the "neutral" or return wire that completes the circuit to ground. On a typical three-pronged polarized electric outlet, the hot side is the smaller of the two slots, and the neutral is the larger slot. The ground is the round hole below the slots.
The grounding prong of a three-pronged plug provides an independent path to the neutral return wire for any electricity that leaks out from the normal pathway. With proper grounding, any stray electricity is immediately conducted back to the neutral wire and then to the earth, creating a short circuit that trips your circuit breaker and cuts off the power. If you reset the breaker without finding the source of the stray voltage, the breaker will trip again. If the insulation failure isn't something obvious like a damaged power cord, you'll need to consult an appliance repair service or an electrician.
The National Electrical Code requires an additional level of protection on circuits in bathrooms, kitchens, garages and basements. Outlets in these areas must be equipped with a ground fault circuit interrupter, or GFCI. These devices, recognizable by the red and yellow buttons between the outlets, cut off power to faulty appliances or circuits. A GFCI works by monitoring the flow of current through the hot and neutral wires. The amount of current in each wire should be the same. If there's a difference, then electricity has found a path to ground other than the neutral wire, creating a dangerous condition. The GFCI instantly cuts off the power, preventing a deadly shock or electrical fire. Once the problem is found and fixed, the GFCI is reset by pressing the red button.