Then he said this about prayer:
What is it then? I will pray with the spirit, and I will pray with the understanding also: I will sing with the spirit, and I will sing with the understanding also.
--1 Corinthians 14:15
The specific intent of this verse in its context was to instruct the saints to not rely on praying, singing and speaking in tongues if no one can interpret. Public prayer, song, and speech are for the edifying of all, not just the speaker.
Another fundamental principle, however, is highlighted in this verse. Regardless of the language I use, I should pray by the Spirit, meaning by inspiration from the Holy Ghost, both in private and in public. I ought not to just rattle off a familiar set of words, which is the definition of vain repetition.
An effective, meaningful prayer is guided by the Holy Spirit. I am fascinated by the notion that Heavenly Father will dictate to me the very prayer He wants me to send back to Him. It reminds me of teaching my children to pray when they were first learning to talk. I would whisper phrases in their little ears that they would then repeat aloud as their prayer. Eventually they learned to say those things on their own.
I now pray each evening with my grandson. At twelve years of age, he needs to move beyond the memorized phrases of his childhood, so before we pray, we talk about what topics should be included in our prayer. We make a list of things we are grateful for specifically in that day and the things for which we should ask for the coming day. Properly prepared with meaningful thoughts, one or the other of us give voice to our gratitude and petitions in prayer.
Praying by the Holy Spirit is a little like that. If I pause before starting my personal prayer and give the Spirit a chance, He reminds me of the blessings I have received and brings to my attention the things I may need. He can remind me of my many weaknesses, mistakes for which I should repent, and help for which I should plead. Investing a few moments in preparation pays marvelous dividends in meaningful prayer.
The purpose of prayer is not to change God but to change me, and nothing penetrates and changes my heart more powerfully than the Holy Ghost. So, if I want to pray a prayer acceptable to God, I should listen to the Holy Ghost to find out what God wants me to pray about.