In the precise example you are giving the preposition to be used is pour. You could also use de façon à. Both express purpose.
Je l’ai cherché de façon à obtenir sa signature.
But chercher could be followed by either pour or à in a slightly different sentence, each sentence having a different meaning.
J’ai cherché pour obtenir sa signature.
Means that you have his/her signature but it was difficult to find a means to get there.
J’ai cherché à obtenir sa signature.
Means you attempted to get his/her signature but does not imply that you succeeded.
Prepositions are like any other vocabulary item, and the first thing to do is to learn what they mean in order to know which one to use.
You will find various online resources, I’m just giving you a couple that are very basic.
On FrançaisFacile and on french-linguistics.
On Termiumplus, there is a less basic lesson on French prepositions.
That being said, when we come to verbs you have to know that some verbs are always followed by a specific preposition, most of the time the choice being between à or de. There are numerous lists to be found online, such as this one, or this other one. Dictionaries also will also sometimes tell you what preposition to use. But you’ll still often have to think about it because lots of verbs can either take à or de, with, of course, a change in meaning. The most common example being continuer à1 or continuer de2, and in such cases you will have to check in a dictionary to make sure which one you need.
1 Je continue à jouer au tennis. → Je joue toujours au tennis, je fais ça de façon régulière.
2 Je continue de jouer au tennis. → Je suis en train de jouer depuis un certain temps et je ne vais pas m’arrêter tout de suite.