Your hamstrings are important muscles in cycling and any tightness can pull on your lower back and knees which can lead to various injuries.
To stretch stand with one foot in front of the other with feet hip-distance apart. Straighten your front leg and bend your rear supporting leg. Lift your bottom backwards and tilt pelvis forward slightly arching your back until you feel a stretch in the back of your straight leg.
Alternatively you can do this stretch lying on your back with one leg and your back flat against the ground. Take the thigh of your stretching leg to 90 degrees and support with your hands. Gradually straighten your knee until you feel a stretch at the back of your thigh whilst keeping your back and other leg flat on the ground.