Using R to make sense of the generalised linear model

What is the difference between the errors and the residuals ? What does it mean for a model to predict something ? What is a link function ? In the current post, we use four R functions (viz., the predict, fitted, residuals and simulate functions) to illustrate the mechanisms and assumptions of the generalised linear model.