Afterlife is a static ability written "Afterlife N." When a creature with this ability dies—meaning it goes from the battlefield to the graveyard—you create that many 1/1 white and black Spirit creature tokens with flying. So a creature with Afterlife 2 leaves behind two flying Spirits when it dies.
The key nuance: Afterlife only triggers on death (battlefield to graveyard), not when the creature is exiled, bounced to hand, or tucked into a library. Also, the tokens are created even if the creature is destroyed, sacrificed, or dies from lethal damage—any death counts. Sacrifice effects still get value from it.
In Commander, Afterlife shines with sacrifice synergies, aristocrats decks, and board wipes that don't exile. You profit from your creatures dying, gaining flying blockers and extra fodder for further sacrifice loops or token payoffs.