Among the key figures in the design of American torture programs during the War on Terror were American psychologists James Elmer Mitchell ( https://en.wikipedia.org/wiki/James_Elmer_Mitchell ) and Bruce Jessen ( https://en.wikipedia.org/wiki/Bruce_Jessen ), who were paid $81m for their work. Irony upon ironies: "Mitchell, who is retired and lives in Land o' Lakes, Florida, spends his free time kayaking, rafting and…
It also wouldn't have happened unless there was solid political support at the highest levels. That includes not only politicians but the parts of a democratic society that isn't necessarily directly elected, within the justice system, military and media.
The system also has been held up under multiple administrations, including one that probed public opinion enough to debate closing it only to turn around and expand it instead, which didn't make a measurable difference with voters. The last part is the key point here.
All this may sound a bit hopeless, but we know how to fix these types of inherent issues in a society, by proper application of division of power.