"The words of my books," said Walt Whitman, "are nothing, the drift of it everything." The various themes in Whitman's works are the most important, the actual erudite terms are only important in upholding these ideas. The main themes of his "O Captain! My captain!" are death of a hero, family, a journey, and defeat vs. victory. The themes are supported by a variety of concrete stylistic techniques, including tone, apostrophe, allusions, archetypes, and repetition.
Death of a hero is the first theme to consider. It's obvious the narrator has great respect for the Captain, rendered by tones of compassion, reverence, and ceremony in the poem. "Exult, O shores, and ring, O bells!" exclaims the narrator, which shows the amount of esteem the Captain deserves. There are several ways the Captain (the hero) could be viewed; the more valid being Abraham Lincoln. In the actual book Leaves of Grass by Whitman, "O Captain! My Captain!" is headed under "President Lincoln's Burial Hymn.",
and Whitman has written to Lincoln's memory before - for example, Abraham Lincoln by Whitman is featured in the Prose Forms: Journals section of The Norton Reader. This historical allusion in the poem contributes to the theme of Death of a hero, in which Lincoln is seen as the "father" of our country (symbolized by the ship) who has fallen dead, "bleeding drops of red."
Moving on to the sub-theme (if you will...) of family, The Captain could also be seen as the narrator's own father, with the ship symbolizing his deathbed. "Our fearful trip is done...the voyage closed and done," says the poem, signifying the trials and tribulations a family goes through. Whether the Captain represents Lincoln or the narrator's own father, the theme is applicable. Another stylistic technique demonstrating Death of a hero...