Alex8 has taken up one point I made in a previous thread on this subject, but not the other.
The likeliest derivation for fag as a slang term for gay people is from the practice in English private residential grade schools (confusingly called 'public schools') of younger students being obliged to perform menial service for older boys, the boys were called 'fags' and the institution 'fagging'. An individual young boy was assigned to an individual older boy, like a personal servant.
At university, (Newton's time) a poor student was given a scholarship, but obliged to wait on paying students. Abuse was very common.
The longer term, 'faggot' (which I don't recall being called) could just as well have developed as an elaboration of the shorter term as the other way around.
I am not up on whether this practice has entirely died out, perhaps some Britts here might know.
'Fagged out' is worn out, 'fag end' the frayed end of a piece of fabric, 'faggot' means a chunk of something in various contexts, even a type of embroidery.