The old way on gasoline motorcycles was to have the twist throttle connect to a steel throttle cable to open and close the throttle valve on the gas engine.
Early electric motorcycles mimicked the mechanical system that the gasoline counterpart used, connecting the steel throttle cable to a clunky Curtis PB-6 pot box that many electric forklifts still use to communicate with the speed controller.
Modern electric motorcycles can now use an electronic twist throttle, the electronic throttle has a few electrical wires coming out that plug right in to the speed controller, when you are shopping for electronic throttles you’ll see a few types out there, the easiest throttle to work with is the 0-5K resistive twist throttle.
Some brands of speed controllers are starting to support a 0-5V Hall Effect throttle, so keep an eye out for new options.
New Options, for many years the Magura brand 0-5k ohm twist throttle was pretty much your only option and they have many happy customers, but now you have another choice thanks to a company called Domino that recently showed up with a 0-5k twist throttle for around $90 that looks to be even better built.