Failings in the school system increase the risk of homelessness, according to a new study.