"Hap" uses alliteration for dramatic effect, bringing its ideas to life on the page and often conveying the speaker's frustration. Sometimes alliteration emphasizes the thematic link between words as well.
In the first stanza, hissing /s/ alliteration in "sky," "suffering," and "sorrow" makes the speaker's imagined "vengeful god" seem all the more mean and hateful. The lines feature broader sibilance as well, boosting the effect:
From up the sky, and laugh: "Thou suffering thing,
Know that thy sorrow is my ecstasy,
That thy love's loss is my hate's profiting!"
It sounds like this imagined god is practically spitting out these words from on high.
Later in the poem, the speaker uses alliteration again when describing the forces that really seem to govern human life. "Crass Casualty," a.k.a chance, a.k.a "hap," has a suitably crass-sounding name. Those sharp /c/ sounds make this personified figure seem brutish and totally uncaring. The phrase leaps off the page, evoking how much this chance figure has ruined the speaker's life.
In the last line, alliteration again conveys frustration while also linking important words together. The speaker's "pilgrimage"—that is, their life's journey"—has been full of "pain." Life, in this case, is suffering. The plosive /p/ sounds are aggressive, helping to convey the idea of life as a punishing experience.