Hamstring irritation can be caused by a few problems relating to either saddle shape or saddle height. A saddle that is too wide for your body will cause interference of the hamstring muscles and surrounding tendons, often causing pain or irritation.
A saddle height that is too high causes the legs to reach further on every pedal stroke and that overstretching of the muscle can cause pain and irritation over time.
If you experience pain in just one hamstring, it could be a sign of a leg length discrepancy. Even if one leg is just slightly shorter than the other, the short leg still has to reach further on the pedal stroke than the other leg. This can be combated with cleat shims placed under the cleat of the short leg.
Some cyclists can experience hamstring pain that is caused by the sciatic nerve rather than the hamstring itself. This condition is called sciatica, and is often due to disc herniation. Bulges in the vertebral discs come in contact with the sciatic nerve roots and causes irritation and pain that radiates down the sciatic nerve and can affect the lower body, such as the hamstrings. This type of pain can be relieved with the standard rest, ice, compression, and elevation treatment, or can be addressed by a physician if it does not get better.
Strength exercises and stretching can help relieve pain and tightness in the hamstrings that is not caused by saddle width or saddle height. Making the muscles stronger makes them less susceptible to problems.