How should I thank mentors that I connect with via the Internet?
A simple email is really all you need. Thank them for their help and update them on your recent progress, say by mentioning that you have been accepted to ...
Don't bother with gifts as they will embarrass many people and might be considered improper. The one exception I can think of is the situation in which you are from a different country or culture. Then a token tourist level souvenir from your country might be fine. Something like this if you are from Sweden (not the world's biggest, though). I find it harder to come up with anything appropriate if you are from the same culture/country, though. The gift should have personal value, rather than tangible value.
Later, when you finish a doctorate, say, and get a great job, you might think of something more elaborate.
But for people you have met and who have helped you, say a teacher, it is a good thing to go back after several years and thank them personally for their mentorship. Just a meeting in a hallway with the statement of thanks for their help and guidance is a deeply satisfying thing to do and to receive.