Poets traditionally use alliteration, or repetition of consonant sounds, to link words with different meanings together and to contribute to the cadence, rhythm or musicality of a piece. Another function of alliteration is onomatopoeic; that is, to represent the sound of an action taking place within the poem.
For example, in Dante's "Inferno," the poet observes "the rising of the boiling bubbles." The alliteration here lies in the repetition of the "b" sounds, which mimic the sound of boiling.
Another example can be found in Allen Ginsberg's "Howl," where the poet describes "boxcars boxcars boxcars racketing through snow." The repetition in this line is of a whole word, but the alliterative effect of the consonants is to audibly represent the sound of a speeding freight train.