In Breaking Bad S5 E14, Jack not only lets Walt go, but also leaves a barrel of money to him after killing Hank. I don't understand why he would do this. Jack says that, with 7 barrels of money, he doesn't need to cook meth any more, so there is no reason to keep Walt (the witness of the killing) alive, let alone to give him so much money. What's the rationale behind this? Or it's just mercy or respect?
I'm guessing it's a mixture of respect and mercy with a good dose of honor among thieves thrown in.
Jack's crew started out as underlings working for Walt. In exchange for their services (usually kill someone) Walt would pay them. Their last outstanding job that Walt had commissioned them to do was to find Jessie and kill him. This was a task that they failed to do. It wasn't until Walt called them that they had a change to get Jessie. In Jack's mind he still had obligations that he needed to fulfill. So not killing Walt was part of that. But Jack also knew how vindictive and ingenious Walt was. If he had stolen all of his money and left him alive, Walt would be a danger. Out of a sense of honor he couldn't kill Walt so he needed to keep things square between them. So he leaves him part of his money and pointedly asks him if everything between them is now finished and square.
Jack let Walter go for two reasons:
As to the first part: It is clear that Walter White will do anything to prevent Hank Schrader from being killed. He even offers the neo-Nazis his entire fortune to prevent this from occurring. However, Jack knows that there's no way that he and his men can aim weapons at federal agents or attempt to murder a federal witness and then hope the entire encounter will simply be "forgotten" by them. At that point Hank and Steve Gomez had to die.
In what has to be one of the most contrived narratives in the history of television, instead of killing the agents, Walt and Jesse, Jack and his men rather stupidly kill two federal agents, leave two living witnesses to this crime, steal almost all of ones fortune and then takes one of the witnesses, captive. This occurs rather than Jack and the neo-Nazis simply killing all of the witnesses, burying them in the holes where the money barrels had been and then simply driving off into the sunset, thus ending the series.
Since Jack knew that Walt was ruthless from his past dealings and from what his nephew Todd had told him leaving him alive was an act of sheer idiocy. Taking Jesse alive considering that he could have escaped and then testified in court as to what he'd seen was another an act of complete stupidity. Since blaming the narrative is never a satisfactory answer to most questions, a logical inference must be drawn that Jack was unable to see how his actions and his inactions would and could easily backfire on him with almost no effort, hence the statement that the neo-Nazis were written to be an exceptionally stupid gathering of individuals.
As to the second part: To'hajiilee is clearly the logical conclusion to the Breaking Bad series. Had Walter simply allowed Jack and the neo-Nazis to murder Hank, Steve and Jesse and kept silent about the money, he would have eliminated all of the major credible witnesses to his drug activities and then simply driven home. He would have kept his millions (less what he would have to pay Jack and associates for killing the assembled group) and there would have no realistic reason to believe that he would have ever been prosecuted for his activities.
Instead, Walter begs for Hanks life then attempts to bribe the neo-Nazis for it and fails. He has all but $10 million of his fortune stolen by them and he allows them to take Jesse Pinkman (the key witness against him) to be taken alive with the possibility that he could escape and potentially convict them all. Since the only reason for all of this to occur is to extend the series a few more episodes to its secondary conclusion, it's clear that To'hajiilee is really the end of the series.
It's a safe assumption to conclude that upon reflection Jack's allowing Walter to live was a narrative conceit of the series' writers and producers that gave them the flexibility of adding several extra shows and the wrapping up the show after "resolving" many of the plot holes and contrivances of earlier seasons. There really isn't any other logical reason for it to have occurred.