How can I apologize to my former research professor whom I ghosted?
Often enough in these kinds of interactions, the situation feels much more dire than it really is because you're not in touch with the professor. You are left to your own devices, building scenarios of how much this professor must hate you now and how terrible it is that you left.
You're fine.
Knot theory is knot for everyone (ha ha!), a fact your professor is probably well aware of. Sure, it would have been nice if you had let them know earlier, but I'm quite sure they realized it during your internship.
The best thing to do now is to reach out to them, apologize for not being in touch earlier. Keep the email short and to the point, no need to write a 1000 word essay. You're likely to get a short reply acknowledging your email and that would be that.
The only point that might have genuinely pissed them off is the books you took and didn't return. Offer to return those as soon as you can, at your expense. While I share your opinion about Munkres, an unpleasant read even for seasoned mathematicians, the books belong to someone else and should be returned.