How to straighten a bent rear mech derailleur hanger?

For aluminium or carbon frames, the answer is : Don’t bother. You may expect a business selling rear mech derailleur hanger to say this, but speaking as a degree educated professional mechanical engineer, it’s really not worth the risk.

Hangers are made from aluminium which when deformed plastically (technical definition!) weakens the structure of the metal. It may be possible to straighten a very slightly bent hanger to get you home, but you need to replace the hanger as soon as you can, since the hanger will be weaker, not be quite the right shape or will be slightly out of alignment making it much more likely to snap the next time.

For steel framed bikes, these usually have a rear mech derailleur hanger integrated into the frame as they can be bent back into shape as steel is less brittle and more able to withstand bending back and forth (although this shouldn’t be done too much). To straighten integrated steel mech hangers, you’ll need a derailleur hanger alignment tool, as its important this is correct so shifting is smooth and the derailleur is not put under additional stress again.