In Shakespeare's Hamlet, Rosencrantz and Guildenstern are two unintelligent Danish nobles who were ultimately fooled by the protagonist and executed by the English king. Their attire, role, and tone in speaking are almost identical and they are almost the same character.
This contrasts with, say, Vladimir and Estragon in Waiting for Godot, as the two tramps have subtle differences in their personalities.
Albeit the preponderance of dissimilar duos in various cultures, almost identical duos also exist ubiquitously. (Say Thompson and Thomson in Tintin, Tweendledum and Tweendledee in Alice) And the similarity is, it seems to me, correlated with a comic effect. Whereas in dissimilar duos this comic effect seem weaker.
Please explain why a correlation between similar duos in narrative works and comic effect exist. The OP, nonetheless, is not satisfied with terms from literary criticism such as 'tension' or simplistic justification such as 'it's funny how they act exactly like each other'.
Edit: the Shakespearean duo is never intended to be the centre of my question. They are used merely to illustrate the preponderance -- and basic function -- of comic identical duos. (The 'comic' effect is not so strong here, yet the duo are alienated and their death is hardly mourned in the play, which somewhat amounts to a comic supplement to the pathos)
IF one really would like me to phrase it philosophically, it would be along the lines of 'is there a theory of humour that could explain the observed comic effect of identical duos in literature, provided that the effect does exist?'