The sartorius is a dual joint muscle that works on both the hip and the knee.
Assuming the knee is stabilized (so that the amount of bend doesn't change), the sartorius can be used to flex the hip. Because of the way where it attaches to the tibia, as well as flexing the hip, it can also cause the hip to externally rotate. And so it's a great muscle for playing hacky sack and doing lotus pose.
While the sartorius can be used to externally rotate the hip it also can act to rotate the shin internally relative to the femur.
The sartorius is one of what could be called the long hip muscles. It's also a hip flexor. (And there is a group of muscles that could be called the long hip flexors).
At their upper ends, the long hip muscles attach to each of the corner points of the hip bone (the ASICs, PSICs, pubic bone, and sitting bone). At their lower ends they attach to either the inner or outer surface of the shin bones. Together, working from stabilized shin bones, these muscles can be used to help control the position of the hip bone relative to the shin bones and femur. They can also help to stabilize it. Working from a stabilized hip bone, these muscles can help control shin rotation relative to the hip bone and femur.
In general, one way to stabilize the hip bone is to create a downwards pull on each of these corner points. At a minimum, if there is a pull on one of the forward points (ASICs of pubic bone) then this would need to be balance by a downwards pull on the PSIC and or the sitting bone.
For any muscle to be controllable, it helps to give it an anchored end point. Working to anchor the top end of the sartorius, it could be anchored by creating an upwards pull on the ASIC. This could come courtesy of the external obliques. An alternative approach would be to create a downwards pull on the PSIC and/or sitting bone.
One other alternative that doesn't rely on external contact or forces (other than gravity) and assuming an upright position, is to shift the ribcage and head back relative to the pelvis so that the weight of the upper body presses down through the sacrum. This can then create a backwards tilting force on the pelvis that may be sufficient to anchor one or both sartorius muscles.
To anchor the bottom end of the sartorius, it may be sufficient to create an external rotation force on the shin since the sartorius works to rotate the shin inwards.
Any muscle needs sufficient length to operate effectively. This means lengthening a muscle just enough, but not too much, so that it can activate effectively.
The sartorius can work to bend the knee (flexing it). It can also work to bend the hip forwards, flexing it. It can also work to rotate the shin inwards relative to the thigh. Doing a standing forward bend, it's easy to use gravity to flex the hips. To remove slack from the sartorius caused by the forward bend, and so that you can use it to actively increase the forward bend, the adductors and or vastus medialis can be activated to help remove some of that slack. This is because the sartorius passes over both of these muscles as it runs down the inner thigh.
Another option to remove slack is to rotate the legs internally.
If the knee is bent (as well as the hip), it may be possible to externally rotat the shin. This could provide enough length for the sartorius to activate and in addition provide an opposing force for the sartorius to work against.
Lifting a leg with the knee straight while standing, the vastus muscles can be used to extend or straighten the knee and to keep it straight. Working against the weight of the whole leg, the sartorius can then activate along with other hip flexors to flex the leg. If the knee is pointing upwards as you lift the leg, it's easy to get the rectus femoris to do most of the work. A simple trick for using the sartorius is to rotate the leg externally and then lift it.
You could also use the sartorius to flex the hip with the knee bent and the hip externally rotated (as it trying to kick a hacky sack with the inner edge of the foot).
A key here is to have the vastus muscles active so that the knee is stabilized at 90 degrees (or whatever knee bend you are using).
A more mundane function of the sartorius can include stabilizing the shin, and thus the knee, while walking or running (or even just while standing).
One reason it can be important in this regard is that by stabilizing the shin against rotation at the knee, the muscles that cross the ankle to support the arches of the feet have a stable foundation from which to work from.
Note that with the knee straight, or nearly straight, the sartorius tends to create an external rotation force on the femur, pushing forwards on the inside edge of the bottom of the femur. At the same time it creates in internally rotating force on the tibia, pulling the inner edge of the tibia rearwards relative to the femur.
What this can feel like is a forwards push on the inner edge of the top part of the knee while at the same time a rearwards (and perhaps even an upwards) pull is generated on the inside of the top of the tibia.
Note that an important point with muscle control is that muscles need an opposing force to work against. What this tends to mean is that in the absence of an external force, an opposing muscle can provide a force for a target muscle to work against. This has two main benefits.
One is that it creates sensation, allowing you to feel "stability".
Two is that it actually creates stability since muscles are working against each other.
Because the sartorius works to externally rotate the hip, it nees an internal rotation force to work against. One muscle that this can come from is the adductor magnus long head. It attaches to the ischial tuberosity, or "sitting bone", the bones we can feel when we sit on a hard surface.
At it's lower end this muscle attaches to the inner surface at the bottom of the femur, just above the knee joint. It can act to rotate the femur inwards. As an added bonus, because it attaches to the sitting bone, it can balance the downwards pull of the sartorius on the ASICs by creating a downwards pull on the sitting bone.
Note that the sartorius also works to rotate the shin internally and so it needs an opposing force to create external rotation on the tibia. That can come in part from the superficial fibers of the gluteus maximus which attaches via the IT band to the outer edge of the top of the tibia.
The tibia and fibula tend to rotate together and so part of the opposing external rotation force on the lower leg bones that the sartorius can work against can come from the short head of the biceps femoris.
This muscle attaches at its upper end to the back edge of the femur. From there is crosses the outside of the knee to attach to the top of the fibula.
Note that an important single joint muscle that creates internal rotation of the shin relative to the femur is the popliteus muscle.
For the biceps femoris short head to function effectively, the popliteus may need to activate to provide a portion of internal rotation force for the biceps femoris short head to activate against.
As mentioned, the sartorius can work to bend the knee and so there needs to be muscle activation to keep the knee straight. This can come from the vastus muscles.
As an interesting side note, the portion of the vastus medials called the vastus medials obliques attaches from the adductor magnus long head to the knee cap and from there to the tibia. For this muscle to work to extend the knee or keep it extended, it helps for it to have a stable foundation. That can be provided by an active adductor magnus long head.
You can read a rather long winded article about some of my experiences trying to fix a problematic sartorius while running in sartorius and inner knee pain.
One of the muscle activations that I found helpful then and still find helpful now is activating the gluteus maximus.
Here again the idea of "taking out the slack" may be relevant. In this case it is with regards to the superficial fibers of the gluteus maximus which ride over the deep fibers of that muscle. So that the superficial fibers can activate effectively it probably helps to have the deep fibers active also. And so to that end, part of stabilizing the knee using the sartorius can include activating the gluteus maximus.
Note that this muscle is an external rotator, and so for it to activate it needs an internal rotation force to work against. This could be why the adductor magnus long head is so important. But in addition, that internal rotation force could come from the iliacus and/or the psoas. The important point is that it comes from somewhere.