It might not always be nice to have to torture your hero or sidekick or anyone else, but sometimes it has to be done. Torture has its uses as a plot device. A villain's choice to torture a character can save them from death and give your good guys a chance to come and save them.
When you have a really nasty villain, it would not be in character for him to just put a character away and forget them. That only leaves him the choice of killing the character or torturing him for information or just to get the hero/sidekick/anyone else to come faster. Thus, if you don't want to kill your character off (obviously, if it's your hero, this is not a good idea) then he might have to endure a little torment. Nothing too damaging if you want your hero to be able to fight the villain afterward; a good beating or maybe a little time on the rack do well.
This might be a little weird, but I suggest you do some research on historical torture devices and techniques. Just use your friend's computer or library card so you don't get flagged for it ;-). If you're going to pull off a believable torture scene, you have to make it sound real and keep the diabolical laughter to a minimum. Otherwise, it will not be taken seriously. Your hero, of course can have a bit of smart banter with the villain. It does not hurt to have a little humor in a torture scene as your readers will be worried and at the edge of their seats as it is.
You may not have to add a torture scene at all, or you may not want to. It's purely a plot choice. Sometimes, you don't have time for one, so don't add one if it's not right for the story.
Another thing to think about when adding a torture scene is what kind of technique to use for your villain. It he's an impatient man, something like a good old fashioned beating would be more normal. He might even do it himself unless he's the kind who do not like to get their hands dirty. If he's a cold-hearted scoundrel who likes to think of devious things to do, something a little more creative is acceptable.
As a note, this was mostly written from the perspective of historical fiction writing, and might not be true to other genres like fantasy or sci-fi. All things should apply, but if you have any questions or want my opinion on anything (yah right, you're saying, I'm sure you want to hear that!) don't be afraid to ask. I'm always open to questions and comments!