A punishment for souls that do not immediately merit to enter gan eden (olam haba?) is to be flung about in the "kaf hakelah". What exactly is that? What is its purpose? Why specifically is that form of punishment used?
It's explained that even after passing away, he doesn't lose his "worldly" desires (or his thought, speech, or action in this world). Therefore, when he goes to Shamayim, those improper "clothes" remain attached to the soul, and the soul can't remove them.
Therefore, to break that klipa, the soul is thrown down into a world of imagination, where he imagines that he is still alive and does all those things which he did back in this world. However, in that world, one cannot remove those garments (unlike here, when one can arouse a love of Hashem even after doing business, etc.) and which results in great pain for the soul (it knows what G-dliness is, and wants to attach itself but can't). Then, as soon as the soul is used to this world again, it is either sent back up (which again causes great pain to the soul) or is moved in this world again to a different "location" (for example, if it loved one thing, the soul will start loving other things, which causes great pain).
The whole purpose of "Kaf Hakela" is to remove the dust from the Neshama, which represents Klipas Noga (which is not G-dly, yet is not forbidden) from the soul. Through being shaken up, he reaches a higher level and this "klipa" falls off from him (when the soul is placed into the world of klippa, and it wants to leave it. This desire removes his "worldly desires" from his soul.
Therefore, this doesn't atone for actual sins. To atone for that, one must go to actual Gehenom.
Also see Or Hatorah