Irony is when something unexpected, often the opposite of what is expected, happens. In the poem “We Wear the Mask,” Paul Laurence Dunbar is using irony to express the idea that African-Americans are putting on a false face (the "mask") to the rest of the world. The irony is in the fact that they appear to be happy, because of the mask, but in reality they are not.
The question that this irony raises for the reader is, why the mask? Why is Dunbar saying that black Americans hide their true feelings? The middle stanza of the poem puts it most directly:
Why should the world be over-wise,
In counting all our tears and sighs?
Nay, let them only see us while
We wear the mask.
For a reason that is unexpressed, Dunbar is saying that African-Americans do not wish to show their “tears and sighs.” Perhaps their pain is too personal, or perhaps they feel that they get along better in the world by appearing to be happy.
In some places, among some people, there was once (and may still be) a belief that African-Americans were a curiously happy people, even under the yoke of slavery. Maybe Dunbar is making a reference to this belief and showing that it is really not a true indication of how African-Americans really felt.
The fact that Dunbar creates this irony and then leaves it to us to ponder gives the poem a different perspective than it would have if he just came right out and said why this is the case. Maybe he isn’t sure himself.