And all with pearl and ruby glowing Was the fair palace door,
This is starting to seem a little fishy. Why do we care what the door is made out of? Well, it turns out that the whole opening of this poem is a kind of riddle, and these lines make up one more clue.
Let's review the evidence, shall we? What has two windows and a door of ruby and pearl, golden tufts on top, and is ruled over by Thought? Give up? It's a human head! Ruby and pearl symbolize lips and teeth, yellow/golden banners stand in for hair, and those two luminous windows are, you guessed it, the eyes.
Through which came flowing, flowing, flowing, And sparkling evermore,
Out of the door (or the mouth) of this palace-head comes something, flowing and sparkling. Notice how Poe uses the sounds of the words here to recreate the things he's talking about. The sound of the words "flowing, flowing, flowing" sounds almost like water or wind flowing along. (Check out "Sound Check" for more on the sounds at work here.)
A troop of Echoes, whose sweet duty Was but to sing,
The speaker tells us that what came flowing out of the palace door was a "troop of Echoes." Apparently their job was just to sing. We think these "Echoes" are connected with the "spirits" we first met in line 19, more quasi-magical inhabitants of the lovely palace. (In ancient Greek myth, Echo was a nymph, who could only repeat the words of others.)
Remember, though, that this is meant to be an image of a human head, too. So this "troop of Echoes" also represents the human voice. In this part of the poem, that voice that comes out of the head is still harmonious, sweet, and nice to listen to.
In voices of surpassing beauty, The wit and wisdom of their king.
The song these Echoes are singing is about how great their king is. They celebrate his "wit and wisdom" (another great Poe alliteration moment).
Again, Poe's working on a kind of symbolic representation of a human being here, so we can think of the Echoes as the human voice, which helps us to see what good shape the witty and wise brain is. The "windows" of the eyes, the "door" of the mouth—those are all ways that we can know what's going on in someone's head, whether things are okay, or if there's some kind of problem.