In the early 80's I read a book where the Earth was destroyed and the last human managed to escape with the last-of-his sort alien back to his home planet. Everyone was dead, but had this machine on their head which was "the best thing you could think of". I would like to know the title of the book and the author.
This very much sounds like Douglas Adams' The Hitchhiker's Guide To The Galaxy, published in 1979, a humorous science-fiction classic.
In the book, the Earth is demolished by galactic bulldozer-ships to make way to a Hyperspace Bypass. Arthur Dent is the only human to survive, when he discovers his best friend Ford Prefect is actually an alien from Betelgeuse Seven, the only one of his race to survive the Great Collapsing Hrung Disaster on Betelgeuse Seven.
Arthur and Ford hitch a ride on the demolition ships and have adventures around the galaxy with the Hitchiker's Guide To The Galaxy, an electronic book that Ford was writing for.
The only points in your question that don't entirely is the return to the alien's homeworld (which was, as I said, destroyed) and the people with the machines in their heads (which might be misremembered, since people had a fish in their ears, doing the translating)