The Infinite Improbability Drive, also known as the Golden Bail, or the Heart of Gold, is the principal motive force of the starship also known as Heart of Gold. It allows the ship (among other things) to instantaneously move from any point in spacetime to any other point. It also means, technically, that literally anything can happen when it is activated. It is therefore potentially the most dangerous and valuable device in the Hitchhiker's Guide to the Galaxy universe.
An ordinary Improbability generator generates small amounts of improbability, causing unlikely things to happen in the immediate vicinity, and is a wow at parties. However, such devices have very finite limitations, and in order to cause a starship to flip across the infinite distances between the furthest stars, the mathematics of the H2G2 universe are such that no less than an infinite quantity of improbability would be required. This made finite improbability generators worse than useless for long-distance instantaneous travel - witness the Starship Titanic.
All attempts to build an infinite improbability generator failed, until a particularly smart individual at the University of Maximegalon reasoned that the probability of an Infinite Improbability Drive spontaneously coming into existence was within the limitations of existing generators. The student calculated the relevant improbability factor and fed it into the finite improbability generator, thus creating the universe's first and only Infinite Improbability Drive out of thin air. After extensive ultra-secret research and development on a remote and almost totally unheard-of planet named Damogran, the Heart of Gold was incorporated into the ship of the same name, which was then stolen shortly before it was launched.
Somewhere in the universe, in a location hidden from and locked to all but six men in the entire galaxy, lay a small worldlet where dwelt a solitary man who was the unwilling supreme ruler of the universe. Surrounding the planet was a vast field of Unprobability to which only these six men had a key. A conspiracy of individuals, including Zarniwoop, Roosta, ex-President of the Galaxy Yooden Vranx, Zaphod Beeblebrox IV and his great-grandson Zaphod Beeblebrox, and quite possibly many others as well, were desperate to find this man and talk to him. They knew where the planet was. But they couldn't get to it, thanks to the field surrounding it.
The Infinite Improbability Drive was the only machine capable of penetrating that field without a key.
Whether the conspirators merely took advantage of the discovery, or actually planned and funded the construction of the IID in the first place, is unknown. However, it can be stated flatly that it was the most important element in their plan to find the ruler of the universe. Zaphod Beeblebrox - part of the conspiracy, but having erased knowledge of it from his own brain - was manoeuvred into the position of President of the Galaxy with the sole intention that he steal the Heart of Gold at its launch, and bring it to the other conspirators.
The conspirers did eventually succeed in their plan, and what happened when Zaphod and Zarniwoop met the Ruler of the Universe is recorded in the book The Restaurant at the End of the Universe. Afterwards, Zaphod got to keep the ship.
The Heart Of Gold itself is a small golden bail, and actually forms one-fifth of the Wikkit Key which the Krikkit robots are attempting to reconstruct in the book Life, The Universe and Everything. Roughly ten billion years ago, the Wikkit Key had ostensibly been blasted into oblivion, but its five components were not destroyed but scattered randomly across spacetime. The spontaneous appearance of the Infinite Improbability Drive is therefore attributed to the Golden Bail dropping back into real space. This does not make a great deal of sense, but when you share a universe with the IID anything is possible. The Krikkit robots later succeeded in extracting the Drive from the Heart of Gold and reassembling the key, but afterwards Zaphod was able to get the Drive back and his ship was restored to full operational capacity. Its whereabouts are currently unknown.
Using the IID
Before the Improbability Drive can be used to go anywhere, you have to know exactly how improbable it is that you will suddenly and spontaneously go there anyway, feed that number into the Drive and turn it on. Crossing the universe takes literally no time. Calculating the factors themselves, on the other hand, is extremely long-winded and tiresome to do, and not helped at all by the presence of Eddie, the Heart of Gold's eternally cheery shipboard computer.
Using the IID to cross the universe has massive, potentially incredibly devastating side-effects for all those not safely inside the Improbability-proof cabin of the Heart of Gold. These effects include, but are not limited to:
(Side note: As a plot device, the IID is possibly the single most cunningly-envisioned object in narrative history, because any and all astoundingly unlikely coincidences and contradictions in the trilogy can be legitimately explained away by means of Improbability fields.)
The Infinite Improbability Drive is an extremely dangerous thing to use, and this is most likely why only one (so far as is known) was ever built. It was later superseded by the Bistromathic Drive, which enables one to cross the universe equally quickly, but without all that dangerous messing around with Improbability Factors, and associated side-effects.