Using molecular dynamics simulations and a coarse-grained model of ionic liquids, we study mechanisms of electrotunable friction measured in friction force microscopy experiments, where only one layer of ionic liquid (IL) is present between the tip and electrode (substrate). We show that the variation of the friction force with the electrode surface charge density is determined by the regime of motion of the confined IL relative to the substrate and tip. The latter depends on the strengths of the ion-substrate and iontip interactions and on the commensurability between the characteristic ion dimensions and lattice spacings of the substrate and tip surfaces. Related with those factors, our simulations predict two strictly different scenarios for the variation of the friction force with the electrode surface charge. Revealing mechanisms of frictional energy dissipation in nanoscale IL films offers a way for controlling friction by tuning ionsubstrate interactions and electrical polarization of sliding surfaces. ''switched'' on and off in situ, by polarizing its surface relative to the reference electrode. Friction phenomena in RTILs have also been studied through computer simulations performed at various levels of system idealization.