I used to wonder about this idea on and off, back when I was religious.
Most people would agree that giving one's life for a good cause is a good deed. Right? You jump the path of a bullet to save someone's life, run into a burning building, etc. These are great heroic deeds. And I would suppose that religious people who believe in reward and punishment in the next life would agree that such people would be rewarded.
But, now, let's suppose a person makes an even bigger sacrifice than just one's own life. Huh?, you might ask. What could that possibly be? Well, what if a person sacrifices the lives of the people he loves, that might hurt him more than losing his own life. But this is no problem. The religious mind has no trouble with that scenario. A person has no right to sacrifice the lives of others and whatever good deed he does, it must be balanced by the terrible thing he did to others. And God (or whomever) ultimately decides where to put such a guy.
Now, let's suppose the guy makes a bigger sacrifice than his own life, but doesn't hurt anyone else in the process. Wha?! What the hell could that be?
What if he sacrifices his SOUL. What if a person does lots of technical sins but in doing so helps out many people. He knows what he's doing, knows that he will be punished in the hereafter, but cares so little for his own well being that he does all he can for others. Every week, the person intentionally breaks shabbos to go work at a soup kitchen and feed the homeless. Instead of paying for excesses like what is needed for tefillin or mezzuzot and such he sends his money to worthy causes around the world. Instead of spending those long days each year begging for forgiveness each Yom Kippur, he is heading demonstrations for foreign governments to stop human rights violations on their own citizens.
Isn't such a person a better person because his sacrifice is so much greater? Sacrificing your life is one thing, but it is a finite sacrifice and having faith in the afterlife doesn't make that sacrifice so great comparatively. But to sacrifice one's soul is a sacrifice for eternity, or at the very least the extremely intense punishment of gehinnom (depending on what exactly the theist believes). Isn't that a greater sacrifice for others?
So, if the sacrifice is so great shouldn't the individual get rewarded? But how can he get rewarded if the reward is exactly what he has sacrificed? So, this is to you schar v'onesh believers, what happens to the individual?