As the most common form of energy used in stationary circumstances - both personal and commercial - electricity is frequently the first choice when it comes to powering air compressors. Electricity is readily available in most places where an air compressor may be used, so it only makes sense that most stationary compressors use this energy source. Further, since electricity is so widely used, it also tends to be less expensive than many of the other alternative power sources. The vast majority of air compressors in use today use electricity as their primary power supply and this has been the case since the beginning of the twentieth century.
Not only electricity widely available and generally fairly cost efficient compared to other power sources, it is also considerably less polluting. From an ecological stand point this does not really matter, since there is a good chance that the electricity was generated by burning fossil fuels, but it can make a huge difference in the building where the compressor is housed. Most of the other fuel sources generate toxic exhaust, which is plainly not a good idea in enclosed spaces. In this respect, electric air compressors make much more sense if they are to be housed indoors.
Although it is not universally the case, generally speaking the primary advantage of non-electric compressors is portability: the fact that they can be used in places that lack an electrical outlet. Using gasoline or diesel certainly makes a lot of sense for compressors being used for industrial purposes away from the central power grid, like loggers or aboard boats. However, there are also portable electric air compressors as well. Admittedly, these are not usually the most powerful models and may not be applicable to many industrial uses, but are still quite useful for various purposes.
Perhaps the most common type of portable electric air compressors are those designed to work with motor vehicles. For adding pressure to tires, blowing up inflatable items, and so on, there are many small air compressors that are designed to work specifically with the electrical system of most road vehicles. Some of these electric air compressors are attached directly to the vehicle's battery, some are plugged in through the vehicles cigarette lighter socket, and some are attached to the vehicle's electrical system in other ways, like through the highlight socket. There are also some portable models that can be fueled by battery packs as well, but this technology remains fairly limited for the time being.
Portable electric air compressors are the most common types available today and they are also among the most affordable. For most purposes, an electrical compressor is probably the right way to go. They are relatively inexpensive, energy efficient, and widely useable.