Does the autopilot attempt to recover from a mechanical failure of a single control surface? I'm asking this question having watched a documentary about Northwest Flight 85 in 2002, during which a 747-400 experienced a lower rudder hardover at an angle of 17 degrees to the left. 

The pilots were able to recover by taking over manual control and using the ailerons, the upper rudder and asymmetrical engine thrust to oppose the forces being generated from the lower rudder hardover.

During the doco, I believe the pilot in control immediately turned off the autopilot as he realised it wasn't going to be able to recover from the initial roll. 

I just wondered if an autopilot would be able to recover from such an event - i.e. is it technically possible? It seems like the sort of thing an autopilot could achieve easier than a pilot, assuming it was programmed correctly.
Normal autopilots don't. They expect all systems to work correctly, and in case of  failure of a single control surface they will stubbornly command actions which are no longer possible. For them, thrust is only for controlling the vertical speed, and the application of asymmetric thrust for yaw control is not possible. 

There are experimental autopilots which compare the result of their actions with a number of pre-programmed scenarios and select for their next commands the scenario which agrees best with reality. These really do what you assumed, but the specific scenario must have been considered before so the specific control laws are part of the code. Computers small enough to be carried on airplanes became powerful enough to do this in real time maybe 20 to 25 years ago, but I am not aware that regular autopilots of airliners have this capability even today. It is, however, used for unmanned vehicles.