I'd like to add:
"Knots" are many times caused from over-reacting GTOs (golgi tendon organ) triggering your muscle spindles to contract (spasm). It can be nutrition as gym girl stated as well.
Why do they happen? To keep your muscle from ripping away from the tendon and bone
Foam rolling is great. However, the hamstring complex holds a pretty deep muscle belly....so you best have a very hard foam roller to get the benefits. Also, you can stand on a tennis ball and roll your foot around on it for about a minute. This will release deep fascia which runs the length of your body.