There are two major parts to this. One is hydration and the other is stretching.
How much water are you consuming daily? Being chronically under hydrated causes your muscles and connective tissues to dry out and become brittle, reducing your flexibility and increasing your chances of injury. As a simple rule of thumb, take your weight and divide by two. Whatever number that is, you should drink that many ounces of water daily. So if you weigh 165 lbs., you should be drinking 82.5 ounces of water daily.
The second part of the answer is stretching. There is more than one kind of stretching, depending on your reason for the stretching. If you are about to do some physical activity or sport, you would do either active stretching or dynamic stretching depending on the activity you'll be doing, sometimes a little of both. Active stretching means you're holding the stretch for 2-4 seconds then releasing the stretch, and repeating it 6-8 times. A dynamic stretch is much quicker and not held at all.
Using the hamstrings as an example:
Active stretch: stand and cross your legs with the feet against each other, we'll say the right in front of left. The right knee will be lightly bent and the left will be straight. Bend over and reach as far towards your toes as you can without feeling pain, just a stretch. Hold for 2-4 seconds, stand back up and repeat that 6-8 times. This will stretch your left hamstrings. Then you'd switch legs and repeat.
Dynamic stretch: Hold on to a pole or a bench with your right hand and with your core active and muscles in the left leg lightly active, kick your left leg forward and up as high as you can and let it swing back down. Repeat that 6-8 times then switch.
The reason for active versus dynamic is the explosiveness of the activity you're going to perform. If you're doing something explosive, like basketball where you're jumping and running, the dynamic stretch is appropriate. If you're a jogger, running at a medium pace, an active stretch is appropriate.
After activity, you can do static stretches, where you take a stretch and hold it for 25-30 seconds. For the hamstrings, you can lie on your back and use a towel around your foot to pull your straight let up until you feel a painless stretch and hold that for 25-30 seconds. This will create a permanent change in the length of the hamstring muscles. Don't do static stretches before activity as you're asking the muscle to shut off, which you don't want to do BEFORE activity.
More Answers from Michael Luque