What is ETOPS and how does it work?
ETOPS stands for Extended-range Twin-engine Operational Performance Standards, a rule which permits twin engine aircrafts to fly routes which, at some point, is more than 60 minutes flying time away from the nearest airport suitable for emergency landing. ETOPS may also be interpreted as Engines Turn or Passengers Swim.
It is not a rule which applies after an engine has failed. Rather, it is a set of regulations and standards which must be met if an airliner wishes to fly its planes more than 60 minutes away from a suitable emergency airport.
History
Early combustion engines were noticeably unreliable. It was not uncommon for a 4-engine piston aircraft to arrive at its destination with only 3 engines running. Twin engine aircrafts, as a result, were required to fly dogleg paths to stay close enough to an adequate airport.
Aircrafts with more than 2 engines were not restricted by this rule. Thus, many transatlantic flights were flown with Boeing 747s and L-1011s, since airliners can fly a more direct route with these aircrafts.
As engineers gained more experience in jets, they slowly recognized that jet engines are much more reliable than their piston counterparts. The FAA began to approve flying twin engines 120 minutes away from a suitable airport. This made twin engine aircrafts popular, because the fuel efficiency of flying a twin is much better than flying a 4-engine 747 or A340.
Certification
ETOPS certification requires both the aircraft and the airline to comply with a set of standards.
For the aircraft, the manufacturer must demonstrate that flying with only one engine is relatively easy for the flight crew, safe for the airframe, and an extremely remote event.
The airline must demonstrate that its flight crew training and maintenance procedures are up to a higher standard. Pilots, engineers and staff must be specially qualified for ETOPS.
Recently, more operators are adopting the ETOPS approach to non-ETOPs routes. They discovered that the approach offers significant improvements in reliability, performance and dispatch rates. The cost of application is later offset by reduced maintenance costs, and costs associated with diversions, delays and turn backs.
Flight Plan
An ETOPS flight plan may look something like this:

Let's say the aircraft's ground speed (with one engine inoperative!) is 450 knots. By drawing circles with radius 450nm around alternate airports, we can obtain areas which the flight must stay within. The flight path always stays inside one of these circles. If we are operating under ETOPS 120, we will draw the circles at 900nm.
Actual flight plans are slightly more complex, since winds aloft (sometimes more than 100 knots) will affect the aircraft's ground speed. Dispatchers use software to calculate a route, taking aircraft weight, fuel consumption and winds into consideration.