An infinitive is the base form of a verb. It can be used with or without to (also called the 'bare infinitive').
Infinitives can be:
subject (To have a party is a great idea.)
direct object (I like to read.)
subject complement (Your mistake was to tell her my secret.)
adjective (This is the best time to leave.)
adverb (You must study to get excellent marks.)
There are a lot of verbs followed by infinitives. See a list of these verbs here.
For more visual explanation, watch this video: