Okay... I'm back. If you're talking only about stretching-the- hamstring/touching-your-toes type motion, then here are some good starting points.
1. Dorsiflex your feet. Sit on the floor with your legs out straight in front of you and bend forward. Note that your toes immediately drop and the arches of your feet pull in towards you. This is what you must resist- as this motion lessens the stretch of the hamstring. When taking the forward bending motion, keep your toes up and your feet flat, as if you were standing. This position is called 'dorsiflexing'. It's actually much harder than it sounds.
2. Work your hamstrings not your back. 99% of the time when you see someone doing forward bends, their back is curved, again relieving the stretch and stopping them from getting truly flexible. To avoid this, start the forward bending motion by straightening the spine as much as possible and then dropping forward as far as you can go. At this point your spine will have bent again. So now look up as far as you can and then straighten your spine. Then drop again, with the effort on keeping the spine long. Only in this way can you achieve full flexibility- meaning that you can go all the way down so that your stomach is on your thighs, your chest is on your knees and your chin is on your shins.
3. Push the backs of your knees down. If you are properly flexible, the backs of your knees can touch the floor when you make this motion. When you first try this there will probably be quite a few inches of clearance. Try as hard as you can to straighten your legs and push those knees down. This gets you extra stretch in the hamstring.
If you do all three of these things then the stretch becomes immeasurably harder, but far more beneficial. Don't be distressed if, when you try them, the effect is that suddenly you are hardly bending down at all. This is a case where you have to go backwards to go forwards- you have to learn to isolate the hamstrings and maximize the stretch. All the old bad habits were preventing you from doing that. Rest assured that very few athletes actually do this correctly- if you can get good habits now you will be way ahead.
There are quite a few other exercises in addition to the seated forward bend that are very helpful, but I've barely gone into how to do that one correctly, so that will have to do for now.