okay it's like this: the jet engine is super fucking hot, yea?
that hot water actually FREEZES sometimes, like when people throw boiling water in the air and it freezes.
in the atmosphere, and also cause of the engine, there is a lot of soot and dust as well, these make great "starter crystals" for the boiling water, which freezes around the dirt really really quickly.
when the humidity in the area is really high, the contrails stay for hours, cause it's cold and wet.
other times planes dont do this, cause it's hot and/or dry where the contrail forms. they melt after a few seconds, or half a minute.