Firstly, the subjunctive is a mood just like the conditional or the indicative. Within the subjunctive there are four tenses; the present, the past, the imperfect and the pluperfect. The latter two tenses are only used in literature so can be ignored for the moment. To form the present you take the first person plural (nous form), take off the -ons and add -e, -es, -e, -ions, -iez and -ent. There are irregular verbs such as être which goes to je sois and avoir which goes to j'aie, however, this question refers to the use of the subjunctive mood.
Primarily the subjunctive is used after verbs or emotion or sentiment (e.g. craindre or souhaiter), verbs which show obligation (e.g. exiger) and verbs which express doubt (e.g. douter). It is also used to express necessity (e.g. il faut que) and negation and refusal (e.g. il refuse que nous allions au cinéma). The subjunctive is also used for impersonal statements --> il est + adjective + que. The verbs croire, espérer and penser when negatives require the subjunctive. Certain conjunctions showing a purpose (e.g. pour que), a restriction (e.g. sans que), a condition (e.g. pourvu que), a concession (e.g. bien que) or time (e.g. en attendant que) also require the subjunctive.