The response differs somewhat depending on whether you are in a 2, 3, or 4 engine aircraft.
Priority one in any case will be to apply rudder to compensate for asymmetrical thrust (unless you lose the center engine in a three-engined aircraft), then trim the airplane for stable flight. Once the nature of the malfunction is identified, the pilot flying should state something to the effect of "Engine Failure/Fire/Serve Damage Checklist, I have the radios", at which point the pilot monitoring will begin carrying out memory items (if applicable) and the abnormal checklist for the situation.
Next the pilot flying will begin to decelerate to the driftdown speed. While this is happening they might declare a pan-pan to air traffic control if they're in a 3 or 4 engined craft or probably a mayday in a 2 engined craft. If they are in an area of high terrain, they might need to begin a 180 degree turn-back, or navigate along another escape route, depending on their location along the route. ATC will need to be advised of the altitude and heading change as soon as practical. Typically this will all be done by the pilot flying in coordination with the rest of the crew of course.
When the airplane has decelerated to its driftdown speed, the pilot flying will begin descending to a lower altitude, one at which remaining thrust is sufficient to maintain level flight. For some twins this might be quite low, 15,000ft or less. For the 4 engined aircraft I currently fly, the plane will maintain an altitude in the high 20's to mid 30's at most weights with 1 engine inoperative.
Boeing makes the performance considerations easy with the "ENG OUT" function of the FMCs on the VNAV pages. The pilot flying would simply set a lower altitude on the mode control panel and select the "ENG OUT" function on the FMC, then select "execute" to allow the airplane to descend at engine out long range cruise (after ATC clearance has been received of course) to the engine out max altitude.
Next, a twin will begin immediately searching for the nearest suitable airport to land at, point in time, and will divert there without delay. A plane with more engines *should*
(cough, speedbird, cough) also divert unless they're already very close to the destination, however the situation is less urgent and continuing a bit to an airport with adequate facilities and perhaps existing company operations can be considered. The exception to this is, as always, if a fire hasn't been or cannot be extinguished. In this case the airplane will be flown to the nearest suitable airport at maximum speed and ditching might even be considered.
In 10 years and 7000 hours of flying I've only experienced a single engine failure, at 500 ft immediately after takeoff in an EMB-135 about 6 years ago. I was an F/O at the time; I simply flew the plane while the captain notified ATC, ran the checklists, and briefed the cabin. We were on the ground no more than 10 minutes later.
I hope this helps.