You shall not murder.
But if a man schemes and kills another man deliberately, take him away from my altar and put him to death.
Humans in general don't have the right to take life, hence the commandment in Exodus 20:13. God, who gave these laws to the Israelites, does have the right to take life (see the article on God's moral authority). Since God commanded the death penalty for certain crimes, the Israelites had the right to execute people, but only when they did so in accordance with God's laws; they didn't, for instance, have the right to come up with a new law of their own and decide that breaking it merited the death penalty.
In some places such as Leviticus 20:11-13, the statement of the death penalty is followed by "their blood will be on their own heads." That is, the Israelites wouldn't be guilty of murder when carrying out a death penalty decreed by God, for the "murderers" would be the people who had sinned in such a way that they deserved to die (in a sense, the guilty had committed suicide by doing something they knew deserved death).
Other responses (offsite)