Shortly after Aharon passed away, Bnei Yisroel came under attack from one of the nations living in Cana'an. The Torah tells us, "And the Cana'ani, the King of Arad, who dwelled in the south heard that Yisroel had come, and he fought with Yisroel" (Bamidbar 21, 1). Rashi explains that this refers to the Amaleikim who lived in the southern portion of Cana'an. Nevertheless, the Torah coins them as Cana'anim because they masqueraded as Cana'anim. Their intention was to render ineffective the tefillos that Bnei Yisroel would offer to enable them to defeat the Amaleikim.
Rav Wolbe (Shiurei Chumash) gleans from here that when one offers a prayer on behalf of another person, they must be careful to specify for whom they are davening. He related a story about Rabi Akiva Eiger, who was requested to daven on behalf of a person who was ill. After davening, he sent back a message that he had davened and was not answered, so it would be worthwhile to verify that there was no mistake made in the name given. They checked and found that indeed there was a mistake in the name! This story emphasizes the need to be clear about the subject of one's prayers. Rav Wolbe adds that to Rabi Akiva Eiger it went without saying that his prayers would be answered, and if they weren't it must have been because there was some mistake made in the relaying of the name.
However, we must appreciate that tefillah is not merely a means of obtaining something that we are lacking, but it is also an end in itself (Alei Shur vol. II pg 348). Tefillah is a thrice daily exercise in emunah. We are training ourselves to become attuned to the fact that there is no one else to whom we can turn. Hashem is the One and only One Who can truly help us in whatever area we need help. This is an end in itself regardless of whether we get what we are praying for.
This answers a legitimate question about how tefillah works. What right do we have to daven for insight, health, wealth or anything else we might be lacking if Hashem put us in that predicament in the first place? The answer is that through recognizing that everything comes from Hashem we become worthy of His assistance, and have the ability to change any situation for the better.
Each tefillah has the ability to strengthen our emunah. However, this will only be the case if we bear in mind that in truth there is no one who can help us but Hashem.