Why does a piece of wood have knots?

Knots mark the spot on a tree where there once was a branch, which has since been encased by the growth of the tree.