In Game of Thrones Season 2, Episode 9: "Blackwater", Varys had this talk with Tyrion Lannister:
Varys: I don't believe I've ever told you how I was cut.
Tyrion: No, I don't believe you have.
Varys: One day I will.
Before that, they were talking about whether or not they believe in old powers, spells and curses. That leads me to assume it's somehow linked to magic. Does Varys ever tell Tyrion or anyone else how he became a eunuch in the books? And if yes, how did it happen?