In watchmaking school, we spent 180 hours or whatever it was, straightening hairsprings.
To do it properly, you remove it from the staff, and place it on a piece of glass. If the distortion is mild, you can do it in situ, but this is one of those things where you really need to know what you're doing. The hairspring must be perfectly flat, perfectly concentric, and the terminal coil just so, as well as the overcoil if present. Sometimes the pinning point at the collet or stud gets twisted also. Adjusting a hairspring will invariably create a beat error, which is not easily remedied in these old watches. The balance complete must be removed from the balance bridge, and the collet adjusted with a special tool to align the impulse pin exactly in the centre of the travel of the tail of the pallet fork, exactly in the middle of the banking. It's a bit trial and error. This process is infinitely easier if there is a movable stud carrier.
It still makes me cringe when I see that I have to do it. Ideally, you just replace it, (hairspring) or even the balance complete.