From childhood to old age, studies are uncovering surprising links between vitamin D and mental health and cognition.