The Hitchhiker's Guide ends by tying up several plots, but leaves us with a pretty clear impression that something else is coming.
First, let's tie up those plots: in Chapters 32 to 34, Arthur, Zaphod, and the others escape from the groups that are hunting them and leave Magrathea forever. So Zaphod escapes from the cops, and Arthur escapes from the mice, and Ford escapes from having to explain things to Arthur very slowly. That part of the ending ties up some of the plots that were started earlier, like the whole "Earth is a computer and Arthur's brain may hold the secret to the universe" plot.
But, hey, thinks Douglas Adams, let's sell some sequels. In Chapter 35, we get the obvious set-up for the next book, where the gang goes off to the Restaurant at the End of the Universe. We know this because it's a clear set-up—Zaphod says they should go get a bite to eat at this place. But did we mention that the next book in the series is titled The Restaurant at the End of the Universe?
Actually, the plan to go to the Restaurant at the End of the Universe comes up right after Arthur Dent has been reading an entry on Galactic Civilization, which asks the question "Where shall we have lunch?" (35.4). Now that, folks, is an absurd coincidence, the kind you wouldn't want in a realistic, serious book, but because Adams is writing comedy, he can get away with that kind of thing—just like he can get away with missiles turning into a poor, sweet whale and a bowl of petunias.
We don't want to spoil the fun of the next book, but if you think about a "Restaurant at the End of the Universe," it seems like a pretty absurd thing—just like The Hitchhiker's Guide itself. After all, the universe is going to end, and there's nothing we can do to stop it, so… we might as well enjoy it, right? Arthur might laugh in the face of danger, but Zaphod has a different idea: to go and eat in the face of danger.
Now, if you listened to the radio series (which, as you may remember from our "In a Nutshell" section, was the first version of this story), you know that the first radio series was six episodes long, and that the last two episodes included the Restaurant at the End of the Universe sequence. So why did Douglas Adams only base this book on the first four episodes?
Well, well, do we have news for you: the short version of the story is that when Adams was writing his radio script, he also got a job working for Doctor Who, and so he was suddenly very busy. He decided to co-write the final two episodes of the Hitchhiker's Guide radio show with someone else (John Lloyd). But when it came time to write the book, Adams wanted to do it by himself; he saved the Restaurant section for the second book, since he thought it would require more revision. For a full description of this mess, check out Neil Gaiman's Don't Panic guide to The Hitchhiker's Guide.
(Trivia: Like many of us, Douglas Adams was a huge procrastinator, always missing deadlines and working up to the last minute. And there's actually a story that his publisher sent someone around to his house to pick up the manuscript of the book, which is why it ends somewhat abruptly. True or false? You decide.)