There are many versions with varying words and melodies. It was the most popular closing piece for public or family occasions in Ireland and Scotland until the advent of “Auld Lang Syne” in 1788 by Robert Burns, which we in America always think of in connection with New Year's Eve but which is actually an all-purpose farewell song. (In case you're wondering, which maybe you're not, that title means “times long past,” except that it's really “old long time.”)
I think our lyrics make the most sense if we imagine them being sung by someone who's leaving his friends and family to go away for good. One sad occasion for this happening in Ireland was the great potato
I've spent my money carousing with my friends,
And any harm I've done has been only to myself.
If I've made stupid mistakes, well, I can't remember them, and
My friends and sweethearts would like for me to stay.
But since it has happened that I should get up and go away,
And that all of you will remain here.
Let's all have one more drink, raising our glasses,
And I'll leave quietly,
While we bid each other goodnight and all the best.
(I haven't been able to find a definitive explanation of what “But since it fell unto my lot, that I should rise and you should not” means, but it seems pretty clear that the speaker is leaving and everyone else is staying. There was at one time a story connecting this song with the execution of some Scottish rebels, but that has been pretty well debunked.)
So picture a warm firelit pub, late at night, with a group of people reluctant to go home because they know that this is the time of farewell for the person who's leaving. He's the last one standing, gives his speech and raises his final glass. Perhaps he decides not to disturb those who've put their heads down on the tables and fallen asleep, so he softly calls out his last goodnight and slips out into the dark.