The movement is triggered by a reflex arc – a basic neural circuit that doesn’t go any further than the spinal cord which means that it can initiate movement even when the brain is non-functional.
When the doctor taps your knee and causes a knee jerk, he or she is triggering exactly this effect. In fact, these movements can be triggered all over the body.
If you’ve ever had a complete neurological examination the neurologist will tap on various points to trigger numerous reflex arcs to check that the nerves going to and from certain muscle groups are in good working order.
One of these arcs causes the movement in the Lazarus sign, which, needless to say, can be quite disconcerting for doctors and quite confusing for relatives if the patient has just passed way.
In fact, you can see from the video how ‘lifelike’ the movement seems.
Probably not recommended if you’re uncomfortable with the sight of recently dead people moving.
Link to video of Lazarus sign.