Prayer is an important concept in Hinduism. Most hindus do it. But we also believe that everything we do should have its foundations in the scriptures. So my question is, does the concept of prayer also have its foundation in the scriptures? Or is it based on something else like acharya's teachings? What are the foundations of the concept of prayer?
I cannot quote scripture as I am not knowledgeable enough. This answer is partly from discourses and partly my own answer. By prayer, if you mean asking God for something good to happen or asking for relief from a bad situation then I don't think these fit in to the framework of Karma. Such prayers are part of Hinduism only because people need solace and hope. For if God were to answer such prayers, He clearly has to intervene in you facing Karmic consequences. Even if He does interfere, it is not clear on what basis he interfers. Millions of good people suffer and their sincere and heartfelt prayers are often not answered. The standard explanation is that it is the fruit of their Karma from an earlier birth.
On the other hand, if you mean chanting stotrams and mantras, it is possible that these are backed by scripture. One possible way by which these could give good effects is that they generate good Karma which will have effect in the future. Precisely what effect a stothram or mantram has is usually documented in the stothram itself. Chanting these might also produce effects that negate or neutralize existing bad Karma. Of course, stothrams are far newer than the Vedas so it is highly unlikely you will have a justification of stothram in Vedas. Of course, the standard explanation of the positive effects of Vedic chants is that the very vibrations that the chants produce is beneficial. There are also many Yagnams prescribed in the Vedas for generating good Karma. These are obviously justified in scripture.
Just to give you an example, every hymn in the Rig Veda where a god is glorified or asked to give something such as riches or protection or release from sins is one prayer.
Rig-Veda, Book 4, HYMN XXXI. Indra. tr. by Ralph T.H. Griffith, , at sacred-texts.com
Do thou who art Protector of us thy friends who praise thee With hundred aids approach us.
May thine assistance keep us safe, thy hundred and thy thousand aids: May all thy favours strengthen us.
Favour us, Indra, evermore with overflowing store of wealth: With all thy succours aid thou us.
Thus scriptures themselves are foundations of the concept of prayer.
I haven't read Vedas and Puranas and my answer is based on my understanding of prayers, and knowledge of Hindu philosophy. The concept of praying in modern times is heavily altered than what it is supposed to be. In modern times when you pray, you ask for something that you lack and that you wish to have so that it will fulfill your hunger of some kind. It can be the hunger for possession, knowledge, peace, or occurrence of some event, etc. It is necessary to understand that if you acquire something that you are incapable of acquiring, you won't be able to rip the benefits of it to the fullest and if you do, you will also have to suffer the underlying effects it creates due to your incapacity.
So the prayers had never been the way they are today. The way of praying in modern times is heavily influenced by the other religions that are equally prominent or simply human evolution. The chant and mantras and stotras that one is supposed to recite during worship or puja and that which is in Sanskrit or originated from Puranas like atharvashirsha, shiv manas puja, ashtakams, Chalisa etc. mainly are describing and praising the deity. It is true that chanting creates vibrations that have underlying effects on your mind, mood and on higher levels, your karma. But by continuously reciting the description of the deity, you are also expected to consciously or unconsciously know what is ideal and pick the qualities of the lord. The deities are like idols(models) or ideals or the best possible versions. while worshiping you pay respect to them by praising their qualities and try to absorb their qualities into yours. There are numerous deities in this tradition with certain specialties and they are worshiped only for a certain set of qualities. The nature of deities is very clearly defined in this culture. If you go to some astrologer or a typical Ayurveda prescriber, he will try to understand what you lack and tell you to worship a specific deity. The sole reason is to make yourself capable by engrossing that specific quality and filling the void for your well-being.
The simplest example can be seen in atharvashirsha that almost every devotee of Ganesha knows.
It starts with,
ॐ नमस्ते गणपतये ॥ (I offer salutation to lord of gana's)
त्वमेव प्रत्यक्षं तत्वमसि ॥ (You are realization of principles)
त्वमेव केवलं कर्तासि ॥ (You are THE creator)
त्वमेव केवलं धर्तासि ॥ (You are THE beholder)
ऋतम् वच्मि ॥ (I speak what is right)
सत्यं वच्मि ॥ २॥ (I speak what is true)
त्वं वाङ्मयस्त्वं चिन्मयः ॥ (you are the speech(literature), you are the thought(pure, ultimate, true thought or idea))
त्वमानंदमयस्त्वं ब्रह्ममयः ॥ (you are the (supreme) bliss, you are the (immortal) consciousness)
एकदन्ताय विद्महे वक्रतुण्डाय धीमहि । (I understand the lord (having single tusk), I meditate upon this lord (having curved trunk))
तन्नो दन्तिः प्रचोदयात् ॥१०॥ (May he grant me the knowledge and inspire me)
So the we can conclude that prayers serve following purposes:
give hope and courage
create blissful environment by chants and their vibrations
Affect your personality consciously and/or subconsciously by inspiring you
The foundation of prayers is in the Vedas and the Upanishads. Some most beautiful prayers from these are
1.asato ma sadgamaya
tamaso ma jyotirgamaya
mrtyorma amrtam gamaya
om shanti shanti shanti.
(Lead me from the asat to the sat. Lead me from darkness to light. Lead me from death to immortality Om Peace Peace Peace).
(Brhadaranyaka Upanishad — I.iii.28)
2.Tejo'si teyo mayi dhehi.
viryam asi viryam mayi dhehi.
valam asi valam mayi dhehi.
ojo'si ojo mayi dhehi.
manyur asi manyum mayi dhehi.
saho'si saho mayi dhehi
3. Rudra yat te dakshinam mukham tena maam paahi nityam. (Svetasvatara-Upanishad)
4.Hiranmayen paatrena satyaapihitam mukham
tat tvam pushan apaavrinu satya-dharmaaya drishtaye (Ishopanishad).
There are innumerable beautiful prayers in the Vedas and all other scriptures.