It's frequently possible to re-rail a derailed car using a locomotive and a specially designed re-railing frog (a big steel wedge that goes under the wheels). Also hydraulic jacks are used. If the car is really off the track on one truck (bogie), sometimes cranes are used to lift one side of the car.