Star Trek failed because it was weird - Trekkies were persecuted because we were weird. It was a match made in heaven.
I hate to go batshit in here, but lets have a look at the shows scheduled during these seasons:
1966: The Andy Griffith Show, My Three Sons, Walt Disney, Combat!, The Beverly Hillbillies, Petticoat Junction, The Lucy Show, Bewitched. Daniel Boone, Flipper, Gilligans Island, Gomer Pyle, Get Smart, Green Acres, Hogan's Heroes, I Dream of Jeannie, Lost In Space, Batman, Man From Uncle
1967: My Three Sons, The Andy Griffith Show, Walt Disney, The Beverly Hillbillies, The Lucy Show, Petticoat Junction, Daniel Boone, Bewitched, Gomer Pyle, Green Acres, Lost In Space, Get Smart, Hogan's Heroes, I Dream of Jeannie, Batman,That Girl, Family Affair, The Monkees, Mission Impossible, Man From Uncle, Dragnet
1968: The Andy Griffith Show, Mannix, Ironside, The Flying Nun, The Carol Burnett Show, Mission Impossible, That Girl, Family Affair, I Dream of Jeannie, Hogans Heroes, Get Smart, Green Acres, Gomer Pyle, Daniel Boone, Bewitched, Petticoat Junction, The Beverly Hillbillies, My Three Sons, The Monkees, Man From Uncle, Adam 12, Dragnet
I may have missed one or two there per season, but nothing on the whole.
Star Trek was scheduled to die trhe same year that Lost in Space did - just as in 1970, all of the Hillbilly shows were simultaniously axed, and later The Munsters and Addams Family were killed together. There was - and perhaps still is - a belief in the industry that genres have a lifespan. You notice the cop cycle creeping back in starting with the reboot of Dragnnet in '67...
But beyond that, "Star Trek" was an odd duck in the pond. Lost in Space, especially by this time, was
undeniably a kiddy show - the Robot/kid/Dr.Smith trio was in play - and I've never known someone into the genre that would lump the two series together.
Which is bad for Star Trek.
All of the fantasy series running at the time were "fun" - I Dream of Jeannie, Bewitched, The Flying Nun; shows like Man From Uncle and Mission Impossible were riding the James Bond franchise coattails. Star Trek was every bit as weird as Lost in Space... but it wanted to be taken seriously. As seriously as Man from UNCLE and Mission Impossible, at least - and the only other "serious" shows running were the detective and cop shows. Mom and Dad were watching other things on the Philco - especially at ten at night, during the third season. "Star Trek" was a weird show. It is almost logical that it was cancelled. But the fanbase - as this BBS proves in post after post - is far from logical.
It will be difficult to spin this particular topic across the rest of the franchise in an equal sense - "Why did the ratings slide" is not the same question, since it was TOS that established the brand, and did so for the most part after its cancellation while it was not on the air first-run. TOS was oddball. And so are we.