First off, what is shock? Shock is the inability to properly circulate blood throughout the body. A more appropriate term is "hypoprofusion." It's basically like losing fuel pressure in a car. Sure, the energy (oxygen) content of the fuel is fine, it's just not getting to where it needs to go.
Hypoprofusion is, ultimately, severe hypotension. Blood pressure is determined by 3 major things. Stroke volume (how much is pumped per contraction), heart rate (these two, collectively, determines cardiac output), and systemic vascular resistance. Not enough of either of those will cause hypoprofusion if the other 2 factors are unable to compensate. So if the patient is in heart failure, the heart can only pump so much faster and the resistance can only go so high before cardiogenic shock sets in. In a patient with anaphylactic shock, the arterioles dilate and there's only so much that the heart can do to pump enough blood to keep the pressure up.
In theory, lifting the legs allows gravity to help pull blood through the veins into the body, and ultimately back to the heart (called "venous return"). An increase in venous return increases the end diastolic volume (how much blood is in the ventricle immediately before contraction), which increases the distension of the ventricle. The more distended the ventricle (to a point) the harder it contracts (via a process known as Starling's Law), the more cardiac output, and the higher the blood pressure.
While this all sounds good on paper, it isn't seen under laboratory conditions.