Contrails are the white lines that sometimes form behind high flying aircraft. They are actually a type of cloud. The cloud forms because jet exhaust contains quite a bit of water. If the humidity is high, then the contrails can persist for a long time, like clouds do.
When jet exhaust comes out of the engine, it’s superheated. So the water is in the form of vapor, steam, and hence it’s invisible. As it mixes with the surrounding (freezing) air it very quickly cools down, and at a certain point it will condense out into water droplets, and then freeze into ice. Because it takes a fraction of a second to do this, then there’s a gap between the engine and the contrail.
via Contrail Science.