There are four common theoretical bases for criminal punishment recognized by scholars: Retribution, incapacitation, deterrence, and rehabilitation. Of these, the only one that could not be served by the death penalty is rehabilitation.
Retribution – this one is obvious, but there is more going on than just a simple knee-jerk thirst for blood. One of the notions that underlies "an eye for an eye" is that it is right and just to punish a wrong with the same harm inflicted on the perpetrator. So, at its best, retribution is not a personal act of vengeance for some sort of self-satisfaction so much as it is the consequence of a moral theory of equivalence (or something like it).
Incapacitation – obviously, a person who is executed is not going to be able to kill again. The same cannot be said for a person who is spending life in prison. The latter person can kill other prisoners, correctional officers, and, if they are paroled, other civilians.
Deterrence – as I remember the scholarly literature from when I was in law school, it was relatively well accepted that the death penalty, as it is currently carried out, does not deter others from committing capital crimes. However, as I have expressed on this thread, I think there is a way that the death penalty could be carried out (guillotine in the public square) so that it would have a deterrent effect.
There are, obviously, counter arguments to each of these points from both a theoretical and a procedural point of view, the most compelling of which to me is that under any regime that permits the death penalty innocent people may be killed. That is undoubtedly true, but remember that we run the risk under a non-death penalty regime that an innocent person could spend the rest of his life in prison, and, as many have said on this board, life in prison is arguably a worse punishment than death. I don't think the answer is to forgo punishment, even the death penalty, but rather to take steps to attempt to ensure that that punishment is inflicted only upon the deserving. This the law does through procedural mechanisms such as the requirement for a jury, the requirement of a finding of guilt beyond a reasonable doubt, the wholesale prohibition of the death penalty on certain categories of people (like the mentally handicapped and juveniles), the requirement for individualized findings on aggravating – mitigating factors, rights of appeal and habeas corpus, and a whole host of other procedural safeguards, not to mention executive clemency.
Anyway, that is far from a complete case, but it is a rough outline showing that the justification for the death penalty is far more than wanting to kill the guy who killed your wife, son, daughter, etc.