Sonata form is the most important form of the Classical period (roughly 1750-1830). It is the most common form for the first movements of, for example, symphonies and sonatas (which usually have three or four movements. The form has three main sections: Exposition, Development and Recapitulation. The first and third of these are divided into two main sub-sections: the first and second subjects.
EXPOSITION
First subject (in the tonic)
Second Subject (in a contrasting key)
DEVELOPMENT
RECAPITULATION
First subject (in the tonic)
Second subject (in the tonic)
The exposition and the recapitulation are almost exactly alike, but for one crucial detail: their keys. This form is all about resolving tonal conflicts. When, in the exposition, the second subject is presented in a contrasting key, this presents a conflict between the tonic (the home key, the key of the first subject) and this other key (usually the dominant). The job of the development is ultimately to get us back to the tonic for the repeat of the first subject. But the conflict is not yet resolved. If the recapitulation were an exact repeat of the exposition, the movement would end in a contrasting key. The recapitulation resolves the conflict of the exposition then, when it presents the second subject in the tonic. This is the most important thing about sonata form. It's easy for sonata form to seem complicated, but at its core this is all it's really about. More important than 'which section goes where' is an understanding of this guiding principle of large-scale tonal conflict resolution.