Compressors are similar to pumps: both increase the pressure on a fluid and both can transport the fluid through a pipe. As gases are compressible, the compressor also reduces the volume of a gas. Liquids are relatively incompressible; while some can be compressed, the main action of a pump is to pressurize and transport liquids.
Many compressors can be staged, that is, the fluid is compressed several times in steps or stages, to increase discharge pressure. Often, the second stage is physically smaller than the primary stage, to accommodate the already compressed gas. Each stage further compresses the gas and increases pressure. Those that are powered by an electric motor can also be controlled using a VFD or power inverter, however many (hermetic and semi-hermetic) compressors can only work at certain speeds, since they may include built-in oil pumps.
The oil pumps are connected to the same shaft that drives the compressor and forces oil into the compressor and motor bearings. At low speeds, insufficient quantities or no oil is forced into the bearings, eventually leading to bearing failure, while at high speeds, excessive amounts of oil may be lost from the bearings and compressor and potentially into the discharge line due to splashing. Eventually the oil runs out and the bearings are left unlubricated, again leading to failure, and the oil may contaminate the refrigerant, air or other working gas.