Rigor mortis occurs after death when muscles remain contracted without ATP. Muscle contraction occurs via the sliding filament theory where calcium ions cause actin and myosin filaments to bind via cross-bridges, using energy from ATP hydrolysis. After death, with no ATP to detach actin and myosin, the muscles remain contracted in a state known as rigor mortis.