Where do the dolphins fly off to during the song "So Long, and Thanks for All the Fish" at the beginning of The Hitchhiker's Guide to the Galaxy? They must go somewhere, because they factor into the story again later...
Because of the relative complexity and fractioning of the HHGTTG canon, this is a somewhat tricky question to answer in any definite way, but I'll give it my best:
The dolphins, in a sense, didn't really go any"where". In the book "So Long, and Thanks for All the Fish", which first addresses the questions of the dolphins in the book canon, they are implied to have been instrumental in pulling the replacement Earth into existence, although that's also a bit of a lateral move.
Their own method for leaving Earth was probably equally lateral in nature, moving them not through 4-dimensional space, but along the axes[sic] of probability, or even more involved transdimensional shenanigans.
The movie was in a few ways simplified when compared to the books, but it's a necessity when moving from page to screen, especially for a work such as this. The depiction of dolphins as flying out of the water is more for the purpose of metaphor and illustration.
As for where they ultimately end up, this was never addressed directly in the books, but the final episode of the radio show provides a possible answer:
At the final and absolute destruction of Earth the dolphins pull Arthur Dent and friends into the gaping maw of eternity better known as The Restaurant at the End of the Universe, where he is reunited with Fenchurch. Surrounding the asteroid on all sides throughout eternity, are the dolphins, swimming and playing in the æther of space.
Of course, this ending has the issue of being uncharacteristically happy, and wasn't written by Douglas Adams, but by Dirk Maggs, specifically for the radio production.