The thermodynamic properties of electron gas under the extreme conditions of high temperature, high matter density, and/or a strong magnetic field largely determine the behaviour of matter in upper layers of neutron stars and accretion columns of magnetized neutron stars in binary systems. A strong magnetic field in these objects makes the motion of electrons across the field essentially quantum. The possible electron degeneracy and relativism of electrons are also important. When studying accretion onto a magnetar in a binary system, the intensive generation of electron-positron pairs in the quantizing magnetic field should also be taken into account. We consider in detail the thermodynamic properties of a gas of free electrons in strong magnetic fields, taking into account their relativism and degeneracy, as well as the equilibrium creation of electron-positron pairs in a high-temperature plasma in the presence of a quantizing magnetic field.