Death closes all: but something ere the end, Some work of noble note, may yet be done, Not unbecoming men that strove with Gods. The lights begin to twinkle from the rocks: The long day wanes: the slow moon climbs: the deep Moans round with many voices.
Ulysses knows that death will end everything, but he still believes he can do great things, things worthy of men who fought against the will of the gods during the Trojan War.
The Trojan War wasn't a war between men and gods, but occasionally the gods would come down and fight with either the Greeks or the Trojans.
"Ere" is an old poetic word that means "before," as in "I will come ere nightfall."
Ulysses observes the sunset and the arrival of night, but it seems like he's thinking about his own death as well. What's with the moaning? It reminds us of ghosts or people mourning a death.
"Lights begin to twinkle from the rocks" is an elegant way of saying the stars are coming out.
…Come, my friends, 'Tis not too late to seek a newer world. Push off, and sitting well in order smite The sounding furrows; for my purpose holds To sail beyond the sunset, and the baths Of all the western stars, until I die. It may be that the gulfs will wash us down: It may be we shall touch the Happy Isles, And see the great Achilles, whom we knew.
It turns out that Ulysses is addressing his friends, at least during this part of the poem. He tells them what he's been telling us all along: it's never too late to go in search of new lands.
Here a "furrow" refers to the track or mark made in the water by the ship. He tells his sailors to "smite" or strike it, most likely with oars.
"Purpose" can mean two different things; it can mean either "destiny," as in "sailing is my purpose in life," or it can mean "intention," as in "I intend to sail as far as I can."
The "baths / Of all the western stars" isn't a place where the stars go to bathe themselves. It refers to the outer ocean or river that the Greeks believed surrounded the (flat) earth; they thought the stars descended into it.
To sail beyond the "baths" means Ulysses wants to sail really, really far away – beyond the horizon of the known universe – until he dies.
The "happy isles" refers to the Islands of the Blessed, a place where big-time Greek heroes like Achilles enjoyed perpetual summer after they died. We might say Heaven.
Ulysses realizes that he and his companions might die, but he's OK with that. If they die, they might even get to go to the "Happy Isles" and visit their old pal Achilles.