In context:
How happy is the blameless vestal's lot!
The world forgetting, by the world forgot.
The second line, in more conventional syntax:
Forgetting the world, and by the world forgotten.
This is a sentence fragment (common in poetry), and the "subject" is only in the previous line. So here, the meaning is that a "blameless vestal" (chaste woman) would be happy, forgetting the world, and forgotten by the world (unlike Eloisa).
The use of "forgot" instead of "forgotten" is common in old poems. ("I know of no reason / Why the Gunpowder Treason / Should ever be forgot.")
How happy is the blameless vestal's lot!
The world forgetting, by the world forgot.
Eternal sunshine of the spotless mind!
Each pray'r accepted, and each wish resign'd;
In the context of the poem, the meaning of the lines is straightforward, syntactically: Eloisa is comparing the 'happy lot' of a hypothetical blameless virgin ("vestal") in the convent with her own tragic fate. The vestal with her spotless mind experiences "eternal sunshine" (sunshine is metaphorically used for brightness, happiness, etc) unlike Eloisa's darkness and torment because of her persisting love for Abelard. All of the vestal's prayers are accepted, presumably because they (and she) are pure and simple, and the vestal easily resigns (gives up) her wishes and submits to the will of God — unlike Eloisa, whose prayer/wish for Abelard can neither be fulfilled nor can she succeed in giving it up.