Outlet grounding confusion
1:
The ground wire is generally connected to the outlet by a third conductor (wire) inside the "wire bundle" that connects the outlet to the circuit breaker box (or fuse box, if you still have one of those).
The circuit breaker box is connected to ground b 2 wires. One runs back to the utility pole with the 2 HOT wires, and the other connects to 1 or more 6'-8' copper-coated "ground rods" that have been hammered into the ground.


2: Because of the way the power is "transformed" from single-phase high voltage on the transmission lines to split-phase 220V coming into your house (see image below), the power always looks for the "shortest" path to ground.

This path is usually from the "hot" pin on an outlet, through your appliance, then back through the "neutral" pin on the outlet. Just in case (in case someone connected the wrong wire to the neutral pin), though, any part of an appliance that's metal and expected for you to touch is connected to the outlet's "ground" pin, to make sure there's no "hot" voltage on it to shock you.

NOTE: This description is of American wiring type. For all other wiring standards, there is no center-tap on the transformer, and (nearly) all outlets are 220V, but most of the basic premise still applies.