The to-infinitive is used in many sentence constructions, often expressing the purpose of something or someone's opinion about something. The to-infinitive is used following a large collection of different verbs as well. See this page about verbs followed by infinitives.
The to-infinitive to indicate the purpose or intention of an action
In this case to has the same meaning as in order to or so as to.
Examples
She came to collect her pay cheque.
The three bears went to find firewood.
I am calling to ask you about dad.
You sister has gone to finish her homework.
The to-infinitive as the subject of the sentence
This is a formal usage and is far more common in written English than spoken
Examples
To be or not to be, that is the question.
To know her is to love her.
To visit the Grand Canyon is my life-long dream.
To understand statistics, that is our aim.
The to-infinitive to indicate what something can or will be used for
In this pattern, the to-infinitive follows a noun or pronoun.
Examples
The children need a garden to play in.
I would like a sandwich to eat.
I don't have anything to wear.
Would you like something to drink?