Spontaneous muscle twitches are thought to be caused by spontaneous activation of motoneurons controlling the muscles.
Spontaneous muscle activity (twitching) is referred to as muscle fasciculations. Most commonly, they are benign, but they can be associated with certain pathologies too, such as ALS.
Fasciculations are thought to originate due to spontaneous activation of muscle fibers due to processes in the motoneurons. At the axonal endings there are synapses that junction onto the muscle. The axonal tips of motoneurons are thought to be highly sensitive to depolarization (electrical firing), which is what triggers acetylcholine release and muscle contraction. The complicated process itself takes a small fraction of a second. If any of this happens involuntarily, then the muscle fiber contracts spontaneously (source: ALS Association).
Specifically, it is thought that spontaneous depolarization of motoneurons are the cause of fasciculations. This decreased firing threshold can be the cause of disease, disrupted ion homeostasis in the body, fatigue, drugs and other causes (Blum & Rutkove, 2007).
Note that spontaneous / random activity in neurons is not only possible, it is quite common. Especially in neurons close to firing threshold, such as the motoneurons responsible for muscle activity, slight perturbations in ion concentrations inside or outside the cell can trigger an action potential. Further, channel opening is a stochastic process, meaning that even voltage-gated Na+ channels can open without a depolarization being present; although the chance is slim that will happen, it can statistically still happen. Stochastic processes like this can cause neurons to fire spontaneously, without a stimulus being present.
- Blum & Rutkove, The Clinical Neurophysiology Primer, Springer (2007)