How does vitamin D benefit your body, and when should you take supplements?

How does vitamin D benefit your body, and when should you take supplements?