The history of anesthetics is both long and convoluted. Opium was long known for its narcotic properties; ancient Sumerians carried opium capsules more than 6,000 years ago.
Later, it was used as an anesthetic throughout the Egyptian, Greek, Roman, and Persian empires. It did not reach the Far East until much later, but in the meantime, the Chinese empire experimented with cannabis, incense, and various herbal techniques. These ancient means of anesthesia were used until the recent prevalence of morphine and aspirin, which were discovered less than 200 years ago.
Beginning in the 19th century, gaseous means of anesthetizing patients were investigated. At first, carbon dioxide was used, followed by nitrous oxide, and finally diethyl ether in 1842. Today's inhaled general anesthetics are far superior to ether, leaving the patient with few to no side effects.
Nitrous oxide is still used, along with a host of newer compounds. Surpisingly, despite the frequency of surgery, the mechanisms behind anesthetics were not fully explored until about 30 years ago. Prior to 1980, the mortality rate among patients given general anesthesia was one in 10,000. Those figures have improved roughly tenfold since then due to a public outcry after the original figures were revealed.
While the exact mechanisms vary from drug to drug, all anesthetics work by blocking nerve signals in one way or another. In fact, patients under general anesthesia show brainwave patterns indicative of a very relaxed state. Just as their mechanisms vary, their potency and half-lives also vary considerably. Some drugs have a lasting effect, while others do not. Some require a reversal drug to bring the patient out of anesthesia, while others cease functioning naturally.
In some cases, usually due to unforeseen biological factors, but also possibly due to human error, an anesthetic effect can wear off before it is intended to do so.
Genetic factors seem to play a role, as well as instable body chemistry. Trauma patients, for instance, undergo rapid fluctuations in blood chemistry, making dosage determination incredibly difficult.