From Cultivate Your Garden (#877) by Rabbi Avigdor Miller
The purpose of tefillah is to gain proper attitudes about Hashem
Of all the things that we’re expected to accomplish in life, the most precious is the creation of the right attitudes in our mind. Everybody knows the statement of the Gemara (Taanis 2a) on the verse “Ule’avdo b’chal levavchem — and to serve Him with all your heart: “eizehu avoda sheb’leiv: hevei oimer zeh tefillah — what’s called service in the heart? Tefillah.”
But in order to understand what’s being said here, it is essential to know what the word heart means. In lashon kodesh (the Holy tongue, Hebrew), heart means mind. The mind — what is the service of the mind? Tefillah!
So the question could be asked, isn’t tefillah a service of the limbs? You say it with your lips, with your tongue. A big part from your anatomy is involved in tefillah, even if you don’t shake back and forth. And yet, we see from the Gemara that the achievement of tefillah is how much thought it creates in you. Therefore avoda sheb’leiv means just like you serve Hashem by tilling your fields —“sheish shanim tizrah karmecha — six years you have to till [your fields and] your vineyards” (Exodus 23:10) — He expects you to till the soil of your mind and produce machshavos (thought), avodah sheb’leiv.
Now, we’ll take the word tefillah and analyse it. Tefillah means l’hispaleil, to think. And hispaleil means to make yourself think. And the Gemara says, “minayin sheHakodosh Baruch Hu mispaleil” from where do we see that Hashem is mispaleil? Now we see He prays, too, but Hashem is not saying anything with words, He doesn’t have any physical attributes that we can use to say He’s talking. And to whom is He praying? So you must say mispaleil, means He is thinking. Hashem’s existence [in a manner of speaking] is machshava, is thought. That’s the ideal form of existence. All thoughts, all wisdom.
Why are we told this mashal (analogy) that Hashem is mispaleil, after all it’s only a mashal. What do we learn from that? Just as He is busy with thoughts, we should also focus ourselves on our thoughts. The purpose of tefillah is to gain proper attitudes about Hashem. We train our minds to think along Hashem’s system, in ways of chachma, and we do that by means of tefillah.