I think I understand how legs of humans work. We have bones to which muscles are attached. Muscles can only contract / relax. By the combination of many different muscles we can make complex movements:
Image source: https://commons.wikimedia.org/wiki/File:1015_Types_of_Contraction_new.jpg
However, I have no idea how this works for insects / spiders. On the one hand, I'm not sure where the muscles should be attached to due to the exoskeleton. On the other hand, I have difficulties imagining that the same system works for legs which are this tiny:
Image source: https://commons.wikimedia.org/wiki/File:Spider-IMG_1630.jpg