Physics and chemistry of upper atmospheres of planets from infrared observations