As a data scientist in biomedicine, I found myself contributing to many projects ad-hoc and pro-bono, either for analysis or writing. Submission of these project's papers can take a long time after my work.
How do I maximize the chances that that my contributions are not forgotten during the submission, if I deserve an authorship?
I thought about sending quarterly reminders, but I do not want to appear pushy about authorship, nor do I want to contribute free work indefinitely (since usually no matter how much I contribute, I often end up as middle authors in these ad-hoc projects). I have had unpleasant experiences in the past where my contribution was either forgotten, re-written, or discarded, resulting in no acknowledgement. Since it can do more harm than good to ask one's name to be added to the paper after the submission (due to the relationship damage), I wonder how I can best protect my interests.