From the original Transformers G1 cartoons, how did Starscream return as a ghost? as far as I know Starscream was the only case where a Transformer returned as a ghost?
I don't think this was ever explained in G1 but it was kind of explained in Beast Wars. From Transformers wikia:
As established in the Beast Wars episodes "Possession" and "Bad Spark", Starscream possesses a "mutant" immortal spark. Even when his body is destroyed, his spark is not extinguished. This explanation retcons the appearance of Starscream's ghost in some season three episodes from the G1 cartoon; the "ghost" was in fact Starscream's disembodied spark.
Also, from tfwiki.net:
Starscream's never give up attitude extends even to the afterlife: unlike most Transformers, he has a mutant, indestructible Spark. His life-force cannot be destroyed and can persist even without a body to contain it. However, there is no indication that Starscream (or anybody else) was aware of this fact prior to his destruction.
In summary, it seems he has a mutant spark, probably because of his "never give up attitude" (or possibly vice versa: his mutant spark caused that attitude).