This poem is really all about the setting. It takes place in a prison, which is the main antagonist of the poem. In other words, the poem is really just a list of the ways that the speaker is able to overcome his sorry lot as a prisoner. And, by overcoming that challenge, he seems all the more impressive and heroic as a result. Ironically, the speaker kind of needs the prison setting in order to write this poem in the first place. (After all, it's hard to use your mind to break free of a place that you can just get up and walk out of.)
We wonder, though, just to what extent this speaker is truly free from his prison cell setting. Whether he's getting tangled up in hair, paralyzed by looks, or comparing himself to caged birds, confinement seems to be all the speaker can think about. The setting, in this way, penetrates every nook and cranny of the poem. So, while the speaker may be able to out-fly the birds, out-swim the fish, and out-sing the linnets, he's still, in some undeniable way, stuck in his confinement. The setting poses a really interesting question then: just what, exactly, are the limits of the human imagination?