You should use the Hosmer-Lemeshow test when you have constructed a logistic regression model and wish to evaluate its fit to your data. It is particularly useful in public health studies where the outcome variable is binary (e.g., disease presence/absence) and you need to ensure your model's accuracy.