Most devotees believe they can talk to God, either orally or mentally through their thoughts. They believe he will listen to them, and even grant them what they ask for. What are the foundations behind such a belief? Is it mentioned in the scriptures somewhere or is it based on teachings of the acharyas?
According Yoga Sutras of Patanjali (PYS), by Swadhaya (i.e by repeating Mantras or by reading scriptures) one can achieve Ishta Devata Darshana (vision of one's favorite deity).
From PYS SAdhana PAda:
SwAdyAyAdishtadevatAsamprayogah || (44)
By repetition of Mantras etc again and again one achieves the vision of the Ishta DevatA.
SwAmi VivekAnada says on this verse:
The higher the beings that you want to get the harder is the practice.
And, as shown in this answer, one of the results of achieving Mantra Siddhi (which is obtained by the performance of Purascharana) is DevatA Darshanam or vision of gods.
So, by reciting scriptures or by doing Purascharana of Mantras, as prescribed, one gets vision of deities and can communicate with them. So, the concept has definitely a basis in scriptures.