A compilation of all the hymns used by the hota-priest to invite the various deities to the sacrifice became the Rgveda. All the Liturgical parts of the Vedas, useful to the adhvaryu-priest, the chief executor of the sacrificial rites, brought together, formed the Yajurveda. Collection of all the musical chants, especially those associated with the Soma group of sacrifices, and to be sung by the udgatr-priest, the singer, was named as Samaveda. The rest, a sort of miscellaneous appendix and addenda, became the Atharvaveda and was assigned to the brahma-priest, considered as the supervisor over the whole sacrificial process.
The great sage Krishna Dvaipayana Vyasa effected this division by collecting all the mantras extant during his time, and editing them into four groups: Rk, Yajus, Saman and Atharvan. He taught them to his four chief disciples: Paila (Rgveda), Vaisampayana (Yajurveda), Jaimini (Samaveda) and Sumantu (Atharvaveda). This is how these four Vedas took shape.
The Vedas are divided in another way too: Mantra and Brahmana. Samhita is the name given to the collection of the Mantras. The Brahmana includes in itself two more sections, the Aranyaka and the Upanishad. If the Mantras comprise the hymns, the Brahmanas contains liturgies in prose. The Aranyakas teach about meditations based on symbolical interpretations of the liturgical rites. The Upanisads may roughly be defined as philosophical treatises dealing with the ultimate problems of life.
Conventionally speaking, it is the Samhita that is indicated by the word Veda. For instance, Rgveda means only the Rksamhita or the Rgveda Samhita. The Brahmanas, the Aranyakas and the Upanisads of the Rgveda have different and independent names and are considered more like its appendages.
These Samhitas, in course of time, branched off, leading to the formation of sakhas or recensions. The origin of these sakhas probably lies in the fact that each of the principal sages like Paila or Vaisampayana had several disciples. These disciples or their successors might have done some editing and readjustment of the Vedic mantras to suit the needs of the rites which they had to perform and upon which local culture too might have exerted its influence.