Check out this very informative video explaining the physiology of stretching from Dianna Cowern (AKA Physics Girl) featuring the hyperflexible contortionist Sofie Dossi and University of Southern California Biomechanist K. Michael Rowley.
Stretching regularly can help your flexibility by changing the water content in your muscles, stem cell differentiation, your sensitivity to the mild pain of gentle stretching, the contract/relax reflex loop from your muscle to your spinal cord, and muscle fibre length.
From what we know, static stretching seems to the best for improved range of motion, with 5 minutes stretch per week per muscle group over a maximum of 6 days a week giving the best results. Read this meta study for more in-depth information https://www.ncbi.nlm.nih.gov/pubmed/29506306