The neutral can, but doesn't have to be, routed through the transfer switch. It depends on the conductor routing. If the conductors enter the transfer switch through one path, and return to the panel through another, you must route the neutral with them.
If they enter and return through a single nipple or conduit, it can remain undisturbed, and you can add a neutral "jumper" conductor that is sized large enough for the generator feed; i.e., the same size as the generator's feeder neutral conductor.
In either case, if the transfer switch becomes the service's main disconnect, the green main bonding jumper between the neutral and grounding buses must remain. If there is a main disconnect ahead of the transfer switch, the jumper should be removed.
In both cases, the main panel remains, or becomes, a sub-panel, and the main bonding jumper remains out, or must be removed, and the neutrals stay, or must be, separated from the EGC's. That means that the panel feeder must be four-wire.