The idiom at wits’ end means to be very upset, or at the limits of one’s emotional or mental limitations.
The phrase originated in the King James Version of the Holy Bible in Psalms 107: 27. “They reel to and fro, and stagger like a drunken man, and are at their wits’ end.” The verse is speaking about people who go back and forth in their devotion to God.
The archaic definition of wit was knowledge. So the phrase meant the people were at the end of their knowledge, at the point where they must rely on faith. Grammarist.com
Therefore when you reach your wits' end, you have no further knowledge to proceed with on your quest to solve this problem. You have no idea what to do. You have gone as far as you can go, tried every tactic at your disposal, depleted your options.
This, then, is the time to let it go, give it up to the Universe. Finally, we reach our wits' end, there is nothing more that we can do, and we let it go. Once you are out of your own way, the Universe is able to step in and take care of it. It will be solved, maybe not in the way you thought you wanted it, but solved, nonetheless. You will always get what you need, whatever is necessary for your growth. The Universe is there to help you, and whenever you reach your wits' end you only need to ask for intervention. You are not alone, you have the entire Universe on your side.