But it does have an important point to make -- do not just heed the miraculous signs, but also carefully consider the message, in evaluating whether a prophet is false or not.
How do the various meforshim deal with this issue? Rashi cites a Sifrei, or the gemara in Sanhedrin, that the false prophet can do it, because he is empowered by Hashem to do it, as a means of testing the Israelites. Thus, וּבָא הָאוֹת וְהַמּוֹפֵת in pasuk 3 is connected with כִּי מְנַסֶּה ה אֱלֹהֵיכֶם אֶתְכֶם in pasuk 4.
or a wonder on the earth, as is written, “If there will be dew on the fleece only, and upon all the ground, dry” [Jud. 6:39]). Even so, you shall not listen to him. But if you say, “Why then does the Holy One, blessed is He, give him the power to perform a sign? [Scripture replies,] ”for the Lord, your God, is testing you [… whether you really love the Lord your God]" (verse 4). - [Sifrei; San. 90a]
It has been taught: R. Jose the Galilean said: The Torah understood the extreme depths [of depravity inherent in] idolatry, therefore the Torah gave him [the false prophet] power therein, that should he even cause the sun to stand still in the middle of the heavens, thou must not hearken to him. R. Akiba said; God forbid that the Almighty should cause the sun to stand still at the behest of those who transgressed His will, but [the Torah refers to one] as Hananiah the son of Azur, who was originally a true prophet and [only] subsequently became a false prophet.Thus, the sign or wonder is only done on behalf of a true prophet of Hashem. But as Rambam writes, the prophet need not perform miracles and wonders time after time. Rather, he gets a chazaka. But if suddenly an established prophet, who has set a sign or wonder which came true, turns around and becomes a false prophet, one still should not believe him, but rather should judge based on the content of his message.
In Mikraos Gedolos, we see how other meforshim explain the matter.
Thus Ramban (bottom left of the page, on ki menaseh) draws the same connection as Rashi, that the testing you is because Hashem has made the ot umofet appear, or let him know about it in a dream.
On the next page, Rashbam assumes that some sign comes about. He explains about the ot umofet that the false prophet knows about it via ruach hatumah, like the Ov and Yidoni. And the "testing" that Hashem did is that, in general, He invested power in the dark arts to know what would come to be. This is not, then, power to perform wonders, but rather power to know the future, which this false prophet is utilizing to convince people he is a real prophet.
Avi Ezer, a supercommentary on Ibn Ezra, makes his own diyuk. He claims that the wonders performed by the false prophet are natural, along the lines of derech hateva. And that is why it is ot umofet in the singular -- he can only do one trick. Meanwhile, the trustworthy prophets of Hashem can perform all manner of wonders. Though, he notes, even if someone can perform all manner of tricks, we still do not listen to him if his message is a wrong message.
Ibn Ezra gives various positions on the matter. Thus, some explain that the false prophet is "stealing" the word of Hashem -- that is, the true prophet gives a sign, and the false prophet hears and uses the sign himself, to bolster his own words. Some say that even if the sign or wonder occurs, one should not listen because it is against shikkul hadaat. (This might refer to Rashi, Ramban.)
Then he gives his own opinion that os and mofes are identical, and that it means a "siman," perhaps to be translated as a mark. He notes that Yeshaya says that he and his sons will be for an os umofes, and this is by showing what will happen with an significant action, such as having his servants go naked, or in his sons' case, with their names, for it was a mark of what terrible things would happen in their lifetimes.
Robert Alter (in The Five Books of Moses, page 636) mentions Ibn Ezra and critiques his position:
This clause creates a certain theological problem because it suggests that the false prophet may have supernatural powers. Abraham ibn Ezra tries to solve the difficulty by proposing that the "sign" is merely a demonstrative gesture on the part of the prophet, as when Isaiah has his servants go naked and barefoot and gives his sons symbolic names. But the term "come about" argues for the fulfillment of some prediction. The idea stated in the next verse that God is "trying" Israel may intimate that He has allowed the fulfillment of the prediction as an element of the trial: even if the false prophet can show you a portent, the falsehood of his message should be evident in his urging you to worship other gods.To attempt to defend Ibn Ezra, even though I don't really agree with Ibn Ezra's reading of the pesukim -- Ibn Ezra surely knows the next pasuk, that the ot umofet comes about! If Ibn Ezra is really only saying it is a demonstrative gesture, then we could read the next verse -- וּבָא הָאוֹת וְהַמּוֹפֵת, אֲשֶׁר-דִּבֶּר אֵלֶיךָ לֵאמֹר: נֵלְכָה אַחֲרֵי אֱלֹהִים אֲחֵרִים
But I don't think we need necessarily go that far. I believe that Robert Alter quite possibly misunderstood Ibn Ezra.
One point Ibn Ezra was trying to establish, to my reading at least, was that there is no distinction between os and mofes. If not for this, I might think like Rashi that the os is a sign in the heavens while the mofes is some miraculous wonder on earth. Or related, as I usually read it, based on the translation of "sign" and "wonder" respectively, the os is some prediction about the future, while mofes is an immediate magical wonder.
Ibn Ezra does not need to say that it is only the demonstrative gesture, with no subsequent fulfillment. Rather, he notes that the names of the children are a demonstrative gesture of an event which will happen in their lifetimes. Thus, this gives itself over to fulfillment.
Ibn Ezra can then be saying that the predicted event actually comes to pass. But that is not necessarily so impressive. For example, someone can predict that Bavel will attack and eventually, indeed, Bavel attacks. And with enough false prophets, one can get lucky with a prediction like this.
If so, it is entirely within the realm of nature. For the os is not some wonder in the sky. And it is not stopping the sun in the sky, like Joshua. And the mofes is not turning the Nile red. With such actions, one could ask how God is empowering the false prophet. With the demonstrative gestures showing future events, fulfillment can just be luck, within the natural order.
Finally, Shadal has an interesting take on this. He writes:
כי מנסה ה ' אלקיכם אתכם : לא שה' יעשה אות ומופת לקיים השקר , אבל הוא מנסה אתכם על ידי שהניח לנביא השקר שיצליח בכזביו . והנה גלוי וידעו לפני המקום שלא ייתכן לשום אדם לעשות אותות ומופתים אמיתיים בזולת שליחותו יתברך , אבל גלוי וידוע לפניו גם כן כי ייתכן לרשעים להתעות את העם בדברים מזוייפים , לכך הקדים לתקן המעוות שיוכל להימשך מהם
Thus, he makes the ot into the declaration of future events and the mofet into a miraculous act. But of course the prophet is not actually doing it. Magic does not exist, and Hashem is not granting him miraculous powers. The idea mentioned in pasuk 4 that "Hashem is testing you" is by letting the false prophet succeed in his tricking of you. Evildoers can mislead the nation with faked things.