[1] In this paper we present modeling studies of air heating by electrical discharges in a wide range of pressures. The developed model is capable of quantifying the different contributions for heating of air at the particle level and rigorously accounts for the vibration-dissociation-vibration coupling. The model is validated by calculating the breakdown times of short air gaps and comparing to available experimental data. Detailed discussion on the role of electron detachment in the development of the thermal-ionizational instability that triggers the spark development in short air gaps is presented. The dynamics of fast heating by quenching of excited electronic states is discussed and the scaling of its main channels with ambient air density is quantified. The developed model is employed to study the streamer-to-leader transition process and to obtain its scaling with ambient air density. Streamer-to-leader transition is the name given to a sequence of events occurring in a thin plasma channel through which a relatively strong current is forced through, culminating in heating of ambient gas and increase of the electrical conductivity of the channel. This process occurs during the inception of leaders (from sharp metallic structures, from hydrometeors inside the thundercloud, or in virgin air) and during their propagation (at the leader head or during the growth of a space leader). The development of a thermal-ionizational instability that culminates in the leader formation and propagation is characterized by a change in air ionization mechanism from electron impact to associative ionization and by contraction of the plasma channel. The introduced methodology for estimation of leader speeds shows that the propagation of a leader is limited by the air heating of every newly formed leader section. It is demonstrated that the streamer-to-leader transition time has an inverse-squared dependence on the ambient air density at near-ground pressures, in agreement with similarity laws for Joule heating in a streamer channel. Model results indicate that a deviation from this similarity scaling occurs at very low air densities, where the rate of electronic power deposition is balanced by the channel expansion, and air heating from quenching of excited electronic states is very inefficient. These findings place a limit on the maximum altitude at which a hot and highly conducting lightning leader channel can be formed in the Earth's atmosphere, result which is important for understating of the gigantic jet (GJ) discharges between thundercloud tops and the lower ionosphere. Simulations of leader speeds at GJ altitudes demonstrate that initial speeds of GJs are consistent with the leader propagation mechanism. The simulation of a GJ, escaping upward from a thundercloud top, shows that the lengthening of the leader streamer zone, in a medium of exponentially decreasing air density, determines the existence of an altitude at which the streamer zones of GJs become so long that they dynamically extend (jump) all the way to th...