Remove the derailleur and use an adjustable wrench to bend it back into shape on the bike. That way you can see when it's straight more easily. Remember to check both vertical alignment and fore-aft alignment. With 5/6/7 speed doing this by eye will be fine. You might get good enough for 8 speed, but with 9 and 10 speed you'll have to be lucky to get reliable shifting using this method. Those setups are just too fussy.
Bike shops have a derailleur hanger alignment tool that does this much more accurately by screwing into the derailleur mounting hole and letting you gauge position against the wheel rim. I've found that with 9 speed often a couple of millimetres at the rim can be the difference between smooth shifting and constant "not quite in gear" clicking in one or two gears.
Edit: this is a classic "trivial with the right tools, impossible otherwise" job on 9 and 10 speed systems. Put the bike in a mechanics workstand, attach the alignment tool, bend the hanger, reattach the derailleur, check the gears and it's done in 5 minutes. The bike shop will probably want to put in a new gear cable and housing for you (because otherwise if the shifting is less than perfect you might blame them rather than the friction in your old gear cable).
The fun part, BTW, is finding a replacement hanger if the bike manufacturer no longer stocks them. There are "clone" manufacturers but the catalog of available hangers is huge (often one bike model has different hangers in different years, so unless you know exactly which frame you have the label on the frame might not help much).