There are a whole lot of reasons. Number one is probably the level of unfermentables in the wort. Mashing too hot can cause a beer to under-ferment, too cool will be too fermentable. There are plenty of threads on this. The other biggie is fermentation temperature. If the temp isn't right (this usually happens if it's too cool), then the yeast may stop early.
Another thing - I've noticed that a lot of times when I think I've finished high (weeks after signs of fermentation - not just airlock activity, but krausen, clearing, etc), it'll continue to ferment, even slowly in the keg. So be sure to go by your hydrometer and give it time, even if it looks like it's done.
Is this just a general question, or can we see a recipe?