When a wheel has a bad S-bend in the rim, a mechanic can often restore it to usability by a process known as bash and tweak.
Bash and tweak is a descendant of an earlier technique known as stomp and tweak, in which the field medic stomps on a tacoed wheel and tweaks the requisite spokes to allow the damaged wheel to fit through the frame (and maybe even the brakes) to get home after a mishap. Bash and tweak is a more fine-tuned procedure.
The floor-model of bash and tweak requires an inflated tire on the rim to cushion the direct impact on the delicate edges of the rim. Mark the section of rim you need to bend. I mark the top side, for instance if the rim is bent toward the left side I will mark the right side so I know where to hit it as I'm looking down. Loosen spokes on the opposite side of the bend, so the rim is free to bash back into something like the desired line. You can wail that rim right over your head in a full-armed swing in cases where the choice is this drastic surgery or a junked wheel anyway.
Today I discovered the desktop version for small but tenacious bends that aren't responding to mere spoke tensioning techniques. The tire was off the rim, but I found that I could make short, sharp strokes down and inward, hitting the edge of the bench while drawing the rim toward me, to angle the impact. This successfully relocated the short sections of rim needing this extra treatment.