There were PD episodes of Star Trek, actually--the first season and about half of the second. This was because some clod in the Paramount legal department didn't register them in the first place. For a while, the episodes from that period were widely available on videotape. But Paramount found a loophole--perhaps through trademark registration? the music?--and legally shut all that stuff down.
I assume that's how most movies and TV shows end up in public domain--someone doesn't renew the copyright, or failed to register it in the first place. Roger Corman was too cheap to send two prints of each of his Filmgroup movies to the LC for copyright registration, so all those titles have been in PD from the day the films were released. CHARADE was in pd for years for an odd reason--Universal didn't stick the proper symbol on the prints. They did someone recover the rights, though.