The Latin phrase deus ex machina was originally used to describe a specific plot device used in Roman and Greek theater. Many Greek and Roman tragedy writers used this device to resolve complicated plots, which could not be resolved otherwise. Today, the same phrase is used to describe a fictional situation where we are presented with something completely unexpected but also implausible, which suddenly helps resolve the plot. The resolution usually comes in the form of a new event or character.
The first example of a deus ex machina is the arrival of Banjo. Sheridan Whiteside, up to this point, has been an insufferable tyrant to everyone around him, including his assistant Maggie. He has, in fact, broken up Maggie's relationship with Jefferson by bringing Lorraine Sheldon into the picture, a vain and superficial (albeit beautiful) actress. There is no apparent way to solve the situation, and, in any case, Whiteside appears not to care about anyone but himself, so there really would be no reason for him to suddenly become a decent human being. However, Banjo, his friend who is also a famous Hollywood comedian, pushes Whiteside to be a better person. Together, they decide to do something to eliminate Lorraine, as she now represents a big problem for Maggie's relationship.
At this point we encounter the second deus ex machina. Banjo and Whiteside decide that the best way to get rid of Lorraine is to trap her in an ancient mummy case, which conveniently has been delivered to Whiteside earlier in the story (although not for that purpose). Even more conveniently, Banjo happens to have a plane, so the next step is to put the mummy case containing Lorraine on his plane and then fly her out to Nova Scotia. As is plain to see, this is a totally implausible situation; however, it allows the plot to detangle and find its resolution.