Mantras were at first conceived in the large Hindu scriptures known as the Vedas. Within almost all Hindu scriptures, the writing is created in painstakingly crafted two line "shlokas" and most mantras follow this pattern, while mantras are often found in particular line or even single word combination.
The important basic mantra is Om / Aum, which in Hinduism is well-known as the "Pranava mantra," the basis of all mantras. The thinking behind this is the Hindu idea of nama-rupa (name-form), which expects that all effects, the ideas or body in existence, inside the phenomenological cosmos, have name and structure of some type. The most essential name and structure is the primordial vibration of Aum, as it is the first manifested nama-rupa of Brahman, the unmanifest reality/unreality. Basically, before survival and beyond existence is only One truth, Brahman, and the first sign of Brahman in existence is Aum. For this reason, Aum is considered to be the most essential and powerful mantra, and thus is prefixed and suffixed to all Hindu prayers. Even as some mantras may invoke individual Gods or principles, the most essential mantras, like 'Aum,' the 'Shanti Mantra,' the 'Gayatri Mantra' and others all finally focus on the One reality.
In the Hindu tantras the life is sound. The highest (para) brings forth existence through the Word (Shabda). Making consists of vibrations at different frequencies and amplitudes giving rise to the phenomena of the world. The purest vibrations are the var.na, the imperishable letters which are exposed to us, incorrectly as the audible sounds and visible forms.
Var.nas is the atoms of sound. A difficult symbolic association was built up among letters and the elements, gods, signs of the zodiac, parts of the body -- letters became wealthy in these relations. For example in the Aitrareya-aranya-Upanishad we find:
"The quiet consonants symbolize the earth, the sibilants the sky, the vowels heaven. The mute consonants symbolize fire, the sibilants air, the vowels the sun? The mute consonants symbolize the eye, the sibilants the ear, the vowels the mind" In effect every letter became a mantra and the language of the Vedas, Sanskrit, corresponds greatly to the nature of things. Thus the Vedas come to represent truth itself. The seed syllable Om represents the original unity of reality, which is Brahman.