1. Player buy-in. Get them to agree before the game starts that the game will have a particular premise. Allow them to make suggestions on the premise, or allow them to suggest modifications. If you bought the ticket on purpose, there isn't much room to complain about the train's destination.
2. Railroad at the top, sandbox below. Top level choices are things like who the characters are, what they're trying to do in the world, what grand plots they're dealing with, etc. Maybe its predestined that everyone in the party is a conscript in the king's army (you got player buy-in, so they're cool with this, right?), but once they're conscripted, trained, and deployed to a remote island to rally a militia and secure the area against the possible invasion of the hobgoblin hordes, they have complete freedom to do so in whatever manner they like. This is good because it gives the players a lot of freedom on moment by moment decisions, but keeps the plot in a bounded area that you can actually prepare ahead of time.
3. Sandbox at the top level, railroad beneath. Maybe the players can choose to do whatever they like, but once they're committed things get far more directed. For example, maybe there are a dozen plot hooks available, but once the players bite on guarding the caravan, they get in a very difficult to escape vendetta with a guild of assassins. This works well because you can dishonestly (but plausibly) blame the fact that the game's a railroad on your player's decisions. After all, you're just running the world logically, right? No one on these forums, or often in real life, will ever count this sort of game as a railroad, even though it kind of is, because its a "natural" railroad.
4. Just railroad the heck out of them and call it a night. But do it with something weird and hilarious. Like a teleporting goblin who keeps popping in, attacking them, and disappearing when he's wounded only to return over and over again. He's really, really mad about something, and he pops up at the most inappropriate times. He's completely ineffectual in combat, but every time the PCs flirt with a girl or try to be serious, they've got a screaming, raging goblin biting at their legs and accusing them of something involving the goblin's sister and a word that no one, not even those proficient in goblinese, can quite translate. This sort of railroad can happen anywhere, and can follow them no matter where they go. But if the players find it entertaining, they won't care.
5. If nothing you do entertains them, quit. It doesn't mean that the fault is yours. But there's no purpose in trying if they're not going to meet you halfway.