The hero is captured. His continued existence is no longer required for the villain's plan. This is the point where a bullet in the back of the head makes the most sense. But no, the villain puts him in an elaborate death trap he will of course escape from. Why?
Well, what if the villain is incapable of directly killing? Maybe a robot bound by Asimov's Laws, maybe a biological sapient who has been hypnotically-conditioned. He cannot kill. He cannot order a killing. He can maybe dance around the concept by referring to it with oblique and obtuse metaphor. If he could hire henchmen capable of killing, little more is needed. But if he cannot even think about killing, not even to give a wink-nudge suggestion, he's in a spot of trouble. If everyone in his organization suffers from a similar inability to kill, the death trap is the ultimate workaround.
"I didn't try to, how shall we say, mortally inconvenience the hero! No, I simply put him in a situation that could prove, ah, rather unpleasant. But he had the means to escape, it wasn't certain death."
This concept has been played with in scifi before, usually with pacifist aliens who have to recruit humans to fight for them in big, honking wars. I think it would play out more amusingly in a noir or spy thriller where any competent villain would have killed the heroes by page 2. It would be funny to see relatively pedestrian heroes undo a conspiracy of robots who are trying to be nefarious villains while still compulsively obeying their conditioning. This includes explaining their plans in detail when asked since they must obey humans.
So, I'm assuming this story was already written at least 40 years ago. What's it called? :)