In the past several melachos, we stretched our vertical warp threads on the frame, set the heddles, and wove our cloth. The final stage of the weaving process is potzei’ah, detaching the cloth from the loom. This requires cutting the threads that hold the finished material in place. Removing stray threads from a garment on Shabbos would be an issue of potzei’ah, as would be pulling a small wad of cotton from a larger cotton ball.
According to the Rambam, the melacha (which he calls botzei’ah, with a letter beis) entails separating woven fabric for a constructive purpose (such as re-weaving torn material). Rashi on Talmud 73a describes potzei’ah as severing surplus threads. There are other opinions as to the details of this melacha that vary from authority to authority; gray areas notwithstanding, they all have to do with perfecting the woven cloth. (See Raavad and Ran, among others.)
In any event, pulling threads out of a garment on Shabbos is not permissible. Unraveling a string or other cord would be a derivative labor of potzeia’ah according to some opinions. (It would probably be wise to defer to these opinions, which include the Rambam and other prominent authorities.)
This is just an introduction to the concepts of the melacha of potzei’ah; it is not a substitute for a full study of the halachos.