When the nerve impulse arrives, it stimualtes the opening of Voltage Gated Calcium channels in the sarcoplasmic reticulum. This means Calcium is released into the sarcoplasm where is can bind to troponin and cause a conformational change, which moves tropomyosin out of the way, freeing up the myosin head binding sites.
Myosin heads can then attach to the actin filament forming crossbridges. ATP is hydrolysed on the myosin heads causing them to bend, which consequently pulls the actin filaments towards the centre and causes contraction of the muscle.
ATP is required for detachment of the mysoin, a molecule of ATP binds to the myosin head causing it to return to its resting position allowing relaxation of the muscle.