so I've been wanting to do this for a while: there are a few ways.
First is to do the IBM method. IBM used selectrics as computer input terminals back in the 1960's before beam springs were a thing. I finally got a chance to take apart an IBM mag card typewriter at keycon and see how it worked.
Under the typebars, there are 6-8 horizontal bars. These get displaced every time you type. If you pay attention, each keypress displaces a unique number of these. IBM put a magnet under each and a reed switch to detect the keypress. You can just as easily use a microswitch under each and "decode" the presses. This is likely the best/easiest way. It's also 100% reversible and won't affect the mechanism much.
Thanks IBM for including digital encoding of all keystrokes: really thinking ahead there.
Other options include:
microswitch under each typebar. I rejected this because it would change the feel
optical switch between each typebar. Expensive, requires some shielding so they don't interfere with eachother, couldn't find ones thin enough to prevent having to stagger them.
magnets on typebars and hall sensors. This is what I was going to go with but I like the IBM method above.
Now there
are differences between the mag card and the 15" selectric it's based on. If you look at the frame, you'll notice there there's drilled points with nothing attached. The mag card is pretty well full up with stuff. Some components are rerouted, and the printing is disabled. I didn't have enough time to fully understand it and figure out how to re-enable the printing, but at least one spring/plastic assembly had snapped which prevented it from advancing the typeball. I don't know how to disable the printing of a selectric (but I don't really want to: I like the loud thump of the typeball hitting the platter.)
Ok hope this helps. I can take mine apart with picture if you like.
Another mod would be to convert it to dvorak, but it's a lot more complex. IBM did make dvorak selectrics (barbara blackburn had one) but I only know of one.
One big problem is the high cost of working Selectrics. You have to pay at least over $100 to get one in at least reliable, working condition. That sort of investment is discouraging for a tinkerer.
I got two working ones for $12.75 with tax. One included the dustcover. I got mine at auction, but you can check craigslist for deals as well.