You can reinstall macOS with just an external keyboard.

Yes, it’s straightforward. Connect any USB or Bluetooth keyboard before you start. Then turn on the MacBook Air and immediately hold Command + R on the external keyboard. It will boot into macOS Recovery regardless of the built-in keyboard being dead.

From there you use Disk Utility to erase the drive (it’s called Macintosh HD), then quit Disk Utility and choose “Reinstall macOS.” The external keyboard works throughout — the installer doesn’t need the internal keyboard at all.

One catch: if your internal keyboard is shorting or sending stuck keys, it might fight your external inputs. Unplug the internal keyboard’s ribbon cable if you’re comfortable opening the machine. If not, try booting with the external keyboard already plugged in and the built-in one covered (don’t let any keys get pressed). Works fine.

The dead keyboard is a non-issue as long as your external one can hit the recovery key combo.