He didn’t, really. It was a rather ignominious end, not one most people would choose. He was slain while hiding behind a curtain in an act of domestic espionage. It’s not exactly a death of glory. But – this line makes me think that Ophelia’s been told otherwise. She’s probably had the blow softened a bit by someone. Someone probably told her that her father died bravely or that he was somehow treated to an honorable end. These are the lies we’ll tell to make it better.
It is, though, a good end for him in that it’s memorable and dramatic. Few people forget how Polonius dies. It is a dramatically good end, for sure.