Heatseeker when locked on target(say a jet), follows the target until the it is hit, what happens when target is moving and changing it's direction.how does the heatseeker it's changes direction at such high speeds?
There are fins on the missile that can control it's flight. Guidance is controlled by a thermal imaging camera that locks onto a heat source and computers keep the heat source in dead center of what you would seen on a view screen were you silly enough to ride the rocket.
Other missiles use similar systems with radar or a laser 'painting' the target. The laser system uses a guidance laser targeting from usually a separate location, either the aircraft or sometimes an operator on the ground in the case of a moving vehicle. This can be watched in some modern military movies (but unfortunately I don't recall which one).
Most heat seeking missiles (IR homing) have sensors fitted into GIMPAL(a kind of gyroscope) which help it to point towards the target even if missile is not.In a chase these missiles first need to have enough speed for its fins to have good affects.This is a considerable problem. Mordern missiles consist of proportional guidance systems which help missiles to intelligently sort out a more easy and efficient way rather than chasing in original path.some of the modern IR homing missiles are AIM-9 Sidewinder(USA),ASRAAM(UK),IRIS-T(GER),MICA(FRA),PL-9(CHINA),Python-5(ISRAEL),R-73(RUSSIA),AAM-1(JAPAN).