Commonly, an infinitive is used with the subject it. The sentence structure is "It is + infinitive" It refers to the infinitive. This expression is used in many ways. Both gerunds and infinitive phrases can function as nouns, in a variety of ways. Gerunds and infinitives can follow certain verbs but not others. You need to remember which verbs can be followed by only a gerund or only an infinitive.

Verbs that can precede only gerunds:
consider, suggest, enjoy, deny, avoid, miss, mind, practice, postpone, resist, finish, quit, give up, put off

Verbs that can precede only infinitives:
offer, decide, hope, attempt, promise, agree, afford, deserve, refuse, undertake, learn, fail, seem, appear, tend, pretend, choose, demand, desire, guarantee, claim, manage, determine, expect, want, wish

Verbs that can precede either gerunds or infinitives without changing meanings:

continue, like, love, begin, start, propose, neglect, stand, hate

Verbs that can precede either gerunds or infinitives but change meanings:

forget, remember, stop, try