The resting membrane potential can be calculated using the Goldman equation, a mathematical formula that takes into consideration the relative permeability of the membrane to different ions.
Goldman equation
The resting membrane potential is maintained by the sodium-potassium pump. This ion pump is a membrane-associated protein that transports ions across the membrane against their concentration gradients at the expense of metabolic energy.
Eion is the membrane potential that would be achieved (at body temperature) if the membrane were selectively permeable to that ion.
voltage-gated sodium ion channels
closed but capable of opening at resting potential (-70 mV)
open (activated) from threshold to peak potential (-50 - +30 mV)
closed and not capable of opening (inactivated) from peak to resting potential (+30 - -70 mV)
voltage-gated potassium ion channels
closed at resting potential; delayed opening triggered at threshold; remains closed to peak potential (-70 mV - 30 mV)
open from peak potential through after hyperpolarisation (+30 - -80 mV)
electrical stimulus causes voltage-gated Na+ channels to open