That question of eternal repetition is a faithful paraphrase from Nietzsche’s book “The Gay Science.” The following is a more accurate and full translation of the original Geman:
“What, if some day or night a demon were to steal after you into your loneliest loneliness and say to you: ‘This life as you now live it and have lived it, you will have to live once more and innumerable times more…’”
This is the Eternal Recurrence passage from Nietzsche. He does not present it as cosmology or metaphysics, but as a psychological and existential test. This framing is not despair, nor doctrine. It is responsibility and affirmation.
Nietzsche wrote extensively on the eternal recurrence and his framing is clear. Live your life in a way that you would want to live it forever. The following quote from his German book “Ecco Homo” frames it as life affirmation.
“My formula for greatness in a human being is amor fati: that one wants nothing to be different, not forward, not backward, not in all eternity.”
Here Nietzsche is saying his “eternal recurrence” has an emotional core. That core, a love of fate. If you truly love your fate, you would accept its eternal return.