This cannot really be understood without an explanation of why the angel of the Lord initiates the wrestling match with Jacob in the first place, and what the meaning of the match, in general, was.
First, let us get clear on one thing: God seems to have initiated the match, because we read “there wrestled a man with him.” So the “man” (God) was the wrestler, and Jacob was the wrestlee, i.e., the wrestled-with; and it was the “man” who “prevailed not,” whereupon he “touched” (a word most commonly chosen to translate נָגַע or naga) Jacob’s hip to put it out of joint. The Lord was, as it were, the aggressor in the contest. Of how many of us can it be said, “God called him out”?
But why? Never mind "why wrestle all night?". You cannot answer that if you cannot first answer "why wrestle at all?" There are several constraints we can identify on an interpretation:
- Whatever the meaning of the contest, it must be one in which Jacob could hold his own against God; he must be able to be declared, by God, to have “prevailed” in the contest; and his prevailing must demonstrate “power with God and with men” (32:28).
- God must have initiated the contest.
- The match is significant enough as to warrant renaming Israel himself based on the event; it must be of profound importance.
- It results in an injury to Jacob, which God deliberately causes after God observes that Jacob will not lose the match.
- The injury itself must be one that Israelites wish to commemorate with a ceremonial food law, regarding something not to be eaten (see 32:31-32).
- Yet Jacob still demands a blessing, and gets it.
- The conferring of the tribal name “Israel” and the food law about the “sinew which shrank” suggest some meaning that extends beyond Jacob and his immediate family.
In short, the explanation that best fits all the above-listed constraints is that the match is for a blessing over Israel—and thus both recapitulates and anticipates the nation’s struggle with God, above all.
But what serves as the initial impetus to wrestle at just this moment (as the question suggests) is that Jacob, after being shown repeatedly to be in the Lord’s care, is still extremely frightened and has earlier that same day prayed most earnestly to God. Thus perhaps the reason the Lord wrestles with Jacob just now is to demonstrate to him his competence to face Esau: if he can hold his own and even “prevail” against the Lord, then he surely can face his murderous brother (who is no longer murderous; but Jacob does not know this).
In short, then, the Lord is literally inspiring Jacob—filling him with the spirit of God—since this third patriarch is dispirited and insufficiently courageous, especially compared to his famously brave grandfather. In other words, it seems to me that the Lord wished to inspire Jacob to greater courage so that he—and the Israelite nation—could take the actions necessary to embrace God’s promise and uphold their part of the covenant.
Still, what is the meaning of the act of wrestling with God, so that Jacob would want to win (and, indeed, contend all night long)? Of course, Jacob did not see the face of God in its full glory, nor did he, in confronting a theophany, quite literally “wrestle” with the spiritual almighty God, who is not confined to mere flesh.
It is possible that, since they were not far from their previous camp, Mahanaim, Jacob recognized this as one of the angels of that “host”—perhaps the leader. If so, then Jacob probably would have recognized this match as a friendly bout, such as allies might engage in, in a military camp. If the angel of the Lord had set upon him in an aggressive, unfriendly posture, Jacob would presumably have fallen to his face in the most abject fear and humility. So I imagine the Lord made it very clear what was happening, such as by appearing to Jacob with a smile on his face, taking a familiar wrestling stance, and saying, “Hello, friend—let’s wrestle!”
So much for the literal meaning. Is there also a figurative meaning? Perhaps, perhaps not. I think that, just as Abraham was called “friend of God” (James 2:23) because they conversed familiarly, so Isaac might be called “God’s wrestling partner.” The contest was held not to convey a recondite symbolic meaning but rather to inspire Jacob—and all of Israel—with the pride of having held his own in a friendly wrestling match against the incarnate God. This implies several things, however, which things together might be called “the meaning.” It implies: (1) God and Israel are on very familiar terms; (2) Israel has God’s respect; (3) God is on Israel’s side as a true ally; and (4) God wishes to inspire Israel (man and nation) to courage.
Those were the implications, yet another, more literal significance is that Jacob sought to win God’s blessing as the prize of the contest (as it were). This God gave, which suggests that the Lord willingly blesses those who are courageous on his behalf. That is the key to the answer to this question.
Naturally, Jacob would want a blessing, and it is God’s aim in the match to confer a blessing. But, if that is indeed God’s aim, why must Jacob extract one with such difficulty? Why wouldn’t God simply give his blessing without any (or further) effort or ceremony? It must be because the Lord wished Jacob to acknowledge the true, extreme value of the blessing. In short, both a lesson in courage, and a test of it, would require effort and struggle (thus he is given the name “Israel”).
Does this not rather interestingly resemble Jacob’s other struggles of securing blessings—first the birthright from Esau, then the blessing from Isaac, and finally his flocks from Laban? Indeed, in each case Jacob wrests what did not at first belong to him, and would not have belonged to him if he had not taken unusual measures that, again, demonstrated his awareness of and faith in the real value of the Lord’s blessing. Note that in all four cases listed here (including the final, wrested blessing), God had already declared that the blessing Jacob sought was rightfully his. Is it not interesting that he had to struggle nevertheless? We might well conclude that the Lord gave Rebekah the Gen 25:23 prophetic vision—“the elder shall serve the younger”—because he knew precisely that Jacob would so greatly value the blessing, and would struggle so hard to earn it.
Jacob persisted all night long because of he was who he was: a man who showed, over and over, how deeply he valued the Lord's blessing, and however cowardly he might be when matched against mere men, he faced God himself with the grit needed to secure that blessing for himself and his posterity.
Besides, the Lord no doubt filled Jacob with his spirit all night long. So perhaps a better explanation is simply to say that God does not do things in half measures. The contest, to be memorable, had to be epic, and to result in a humbling injury. This epic encounter with God made what Jacob had thought would be the main event—the confrontation with Esau—a minor afterthought, a mere denouement.