What you are seeing is a special strap designed to reduce knee pain in athletes who run and jump frequently causing microtrauma to the patellar tendon. The straps are a form of patellar orthotics (bracing) called infrapatellar straps or bands. The different colors represent different brands sold by different companies.
The patellar tendon is part of the quadriceps mechanism. The quadriceps muscle is the large, four-part muscle that covers the front of the thigh. Contraction of the quadriceps muscle straightens the knee.
The muscle becomes tendinous around the patella (knee cap) and has its final attachment or insertion point just below the knee cap. The tendon and connective tissue around the tendon act on the patella like a pulley system to pull the tibia (lower leg bone). The final result of a strong contraction is a straight leg.
Repetitive contraction of the patellar tendon/quadriceps muscle can create local mini-trauma at the patellar tendon insertion point below the patella. This type of chronic strain may result in a condition of knee pain referred to as jumper’s knee.
As you have observed, the straps are worn most often by athletes who are engaged in squatting, jumping, and running activities that require moving from knee flexion to knee extension. These are the folks most likely to be experiencing pain from a patellar tendon problem.
The strap puts pressure on the patellar tendon with the hope of reducing the strain or tension at the point of pain. Despite how the strap looks, it’s not designed to actually push the knee cap up. The general effect is to reduce strain on the tendon and thereby reduce pain.