Second Treatise: "'Guilt', 'Bad Conscience', and Related Matters"

In the "Second Treatise" Nietzsche advances his thesis that the origin of the institution of punishment is in a straightforward (pre-moral) creditor/debtor relationship.
Man relies on the apparatus of forgetfulness which has been bred into him in order not to become bogged down in the past. This forgetfulness is, according to Nietzsche, an active "faculty of repression", not a mere inertia or absentmindedness. Man needs to develop an active faculty to work in opposition to this in order that promises can be made that are necessary for exercising control over the future: this is memory.
This control over the future allows a "morality of custom" to get off the ground. (Such a morality is to be sharply differentiated from Christian or other "ascetic" moralities.) The product of this morality, the autonomous individual, comes to see that he may inflict harm on those who break their promises to him. Punishment, then, is a transaction in which the injury to the autonomous individual is compensated for by the pain inflicted on the culprit. Such punishment is meted out without regard for moral considerations about the free will of the culprit, his accountability for his actions, and the like: it is simply an expression of anger. The creditor is compensated for the injury done by the pleasure he derives from the infliction of cruelty on the debtor. Hence the concept of guilt (Schuld) derives from the concept of debt (Schulden).
Nietzsche develops the "major point of historical methodology" that one must not equate the origin of a thing and its utility. The origin of punishment, for example, is in a procedure that predates punishment. Punishment has not just one purpose, but a whole range of "meanings" which "finally crystallizes into a kind of unity that is difficult to dissolve, difficult to analyze and [...] completely and utterly undefinable" (§13). The process by which the succession of different meanings is imposed is driven by the "will to power"—the basic instinct for domination underlying all human action. Nietzsche lists eleven different uses (or "meanings") of punishment, and suggests that there are many more. One utility it does not possess, however, is that of awakening remorse. The psychology of prisoners shows that punishment "makes hard and cold; it concentrates; it sharpens the feeling of alienation" (§14).
The real explanation of bad conscience is quite different. A form of social organization, i.e. a "state," is imposed by "some pack of blond beasts of prey, a race of conquerors and lords." Such a race is able to do so even if those they subject to their power are vastly superior in numbers because these subjects are "still formless, still roaming about", while the conquerors are characterized by an "instinctive creating of forms, impressing of forms" (§17). Under such conditions the destructive, sadistic instincts of man, who is by nature a nomadic hunter, find themselves constricted and thwarted; they are therefore turned inward. Instead of roaming in the wilderness, man now turns himself into "an adventure, a place of torture.” Bad conscience is thus man's instinct for freedom (his "will to power") "driven back, suppressed, imprisoned within" (§17).
Nietzsche accounts for the genesis of the concept "god" by considering what happens when a tribe becomes ever more powerful. In a tribe, the current generation always pays homage to its ancestors, offering sacrifices to them as a demonstration of gratitude to them. As the power of the tribe grows the need to offer thanks to the ancestors does not decline, but rather increases as it has ever more reason to pay homage to the ancestors and to fear them. At the maximum of fear, the ancestor is "necessarily transfigured into a god" (§19).
Nietzsche ends the Treatise with a positive suggestion for a counter-movement to the "conscience-vivisection and cruelty to the animal-self" imposed by the bad conscience: this is to "wed to bad conscience the unnatural inclinations", i.e. to use the self-destructive tendency encapsulated in bad conscience to attack the symptoms of sickness themselves. It is much too early for the kind of free spirit—a Zarathustra-figure—who could bring this about to emerge, although he will come one day: he will emerge only in a time of emboldening conflict, not in the "decaying, self-doubting present" (§24).