An active stylus like an Apple Pencil will usually work without modification, on tablets like an iPad that are designed to work with it.
In some cases a passive (capacitive) stylus will not work on its own, since it is designed to read something with the same characteristics as a stylus contacted to a human body.
A solution that can work is to add a “grounding wire” — a conductive wire that touches the stylus and is electrically grounded. (It is possible to pick off a ground wire from the pen-lift servo motor, in case that is helpful.) In our experiments here that has generally worked.
However, your particular screen and stylus may not behave the same way, and you may need to experiment with it further.
Here are old reddit and stackexchange posts that describing the same general issue; you are certainly not the first.
Enhance a grounded stylus to trigger capacitive screen
byu/azertguigui inAskElectronics
https://electronics.stackexchange.com/questions/23036/how-can-a-capacitive-touch-screen-be-triggered-without-human-contact