I understand there was only on Veda originally and then people divided/classified the same in four Vedas for their convenience, then the division and classification has been going on, people had been busy doing it, till at one time the number reaches to 1131.
It was Vyasa, a sage who divided the original Veda into four. He became known as Veda Vyasa, "splitter of the Vedas".
Sam Veda has only about 65 new verses, the rest 1810 verses are repetitions from Rig Veda.
"The Samaveda, is the Veda of melodies and chants. It is an ancient Vedic Sanskrit text, and part of the scriptures of Hinduism. One of the four Vedas, it is a liturgical text whose 1,875 verses are primary derived from the Rigveda". Wikipedia
https://en.wikipedia.org/wiki/Samaveda
Keep in mind that the Vedas were originally transmitted orally. They were not written down until after at least several centuries of oral transmission. That's probably the single biggest reason for the structure and meter of the verses, and for Sanskrit being as structured as it is (a separate subject and thought on my part). Being so structured, it was easier to remember. Vedic Sanskrit was probably also tonal... it's a lot easier to remember the lyrics of a song in the context of the music.
Anyway, there were no books to flip back and forth through to cross-reference, there were no indices. My best guess, and that's all it is, is that the reason the Sama Veda contains elements of the Rig Veda is because those parts of the Rig Veda are pertinent to the Sama Veda, or the lessons being taught. When chanting what became the Sama Veda, the orator probably orally referred back to the Rig Veda.
At some point someone began transcribing what he (or she, female sages were not unknown) heard. These recitations were transmitted with absolute and incredible fidelity, not visarga or anusvara was lost. Those oral recitations probably contained the parts of the Rig Veda that were pertinent. So now it's set down on banana leaves, bark paper, or what-have-you, and it is now set to writing.