Contrails are basically the condensation trail left behind by jets flying through the sky. There are two different way that contrails can form: directly from water vapor or by a cooling process.
When contrails are formed directly from water vapor, the hot exhaust from a jet's engine causes the cool air in the high levels of our atmosphere to saturate. This is similar to when you can "see your breath" during times of cold temperatures. In the case of contrails, ice crystals are formed high in the sky creating the contrail cloud that you see. The engine exhaust may even leave particles on which the ice crystals collect to form the high, thin cloud.
When contrails form by a cooling process, the wind flowing over a plane's wings causes a reduced pressure. This reduced pressure causes air to cool. This cooling can saturate the air creating the contrail.
You may see contrails in the sky long after a plane has passed. This only happens when the relative humidity in high in the upper levels of our atmosphere. If the humidity is low, the contrails may evaporate quickly.
If you would like to read more about contrails, check out these links: