Troubleshoot subforms

I don't understand how subforms work. Please give me an overview.

All of my records show up in my subform — they don't change when I move from record to record in the main form.

I get #Error? or #Name? when I try to display data from my subform on my main form.

Why can't I display form headers and form footers in my subform datasheet?

My subform is too slow. What can I do to speed it up?