As an Amazon Associate I earn from qualifying purchases @AMAZON
It is my observation (using a power meter in real time): tight hamstrings reduce power output by resisting the quadriceps.
A power increase of 10-15 watts after I stop and stretch the hammies out is not uncommon. Not only does this free up the quadriceps from resistance of their own and from the hamstrings, I typically can increase cadence another 5 rpm or so. The extra power is likely due both to reduced resistance (tightness) as well as allowing the legs to coordinate quads/hamstrings better on each pedal stroke.
When to stretch
I rarely stretch before a ride. It’s not smart for one thing— muscles are cold and stiff, the worst possible time to stretch.
Instead, ride easily for 10-15 minutes, then stretch.
Stretching after the workout is a smart move, contributing to long term flexibility. Stretching in a nice warm shower can be much more enjoyable too.
See also Using a Foam Roller.