[General Notes] [Present Subjunctive] [Imperfect Subjunctive] [Present Perfect Subjunctive]
[Pluperfect Subjunctive] [Other Subjuctives] [Imperative] [Detailed Cases]

Some textbooks have incredibly long lists of when subjunctive should be used. Such a list is attached here as well, however to summarize it, subjunctive is used to express emotions and feelings as opposed to indicative which refers to actual (or likely) events.
Here are the 4 main cases:
Present Subjunctive hable Emotions today and tomorrow about something being done today or tomorrow.
Imperfect Subjunctive hablara/hablase Emotions yesterday about something done before yesterday; 
Conditional sentences referring to something unreal today or tomorrow.
Present Perefect Subjunctive haya hablado Emotions today and tomorrow about something done yesterday.
Pluperfect Subjunctive hubiera/hubiese hablado Conditional sentences referring to something unreal yesterday.
Note that emotion is expressed by one person, while action is being done by another:
Ella teme que el gobierno no haga nada. -- two subjects, thus subjunctive
Ella teme no hacer nada. -- one subject: no subjunctive.

Use the present subjunctive to express influence over actions that subject would or would not like somebody else to do, but cannot directly control. The following construction is often used:
Subject 1 + verb of influence (ind) + que + Subject 2 + action to be done (subj)
 (Yo) quiero que (Uds) vengan mañana.
As opposed to: 
(Yo) quiero venir mañana.
See conjugation of regular, irregular and stem-changing verbs.

Use imperfect subjunctive (past subjunctive) in the same situations as present subjunctive, but when referring to past events:
Quiero que juegen esta tarde. -- I want now, thus present subjunctive.
Quería que jugaran por la tarde. -- I wanted, thus past subjunctive.
This is like correspondence of tenses in English -- after a past tense (either Preterit or Imperfect) in an independent clause, one should use a imperfect (past) subjunctive.
Also when discussing situations in the present or future that are contrary to the fact or very unlikely (2nd type of conditional sentences).
Si lloviera, no saldría.
See conjugation of regular, irregular and stem-changing verbs. 
Use the present perfect subjunctive when expressing present feelings or emotions about something that has already occured:
Le sorprendo que ella me haya mandado las tarjetas postales.

To form the present perfect subjunctive, use

haya
hayas
haya
hayamos
hayáis
hayan
+ past participle

For formation of past participle see conjugation of regular, irregular and stem-changing verbs.


Use pluperfect subjunctive when discussing situations in the past that are contrary to the fact (3rd type of conditional sentences).
Si hubiera ido a la fiesta, habría visto a Isabel.

To form the pluperfect subjunctive, use

hubiera
hubieras
hubiera
hubiéramos
hubierais
hubieran
+ past participle

For formation of past participle see conjugation of regular, irregular and stem-changing verbs.


Some textbooks mention two other subjunctives -- Future and Future Perfect, although I do not think they are used at all. Just for the sake of it, here is conjugation of hablar in those two:
Future Subjunctive
Future Perfect Subjunctive
hablare
hablares
hablare
habláremos
hablareis
hablaren
hubiere hablado
hubieres hablado
hubiere hablado
hubiéremos hablado
hubiereis hablado
hubieren hablado

Use imperative to give commands -- positive or negative ones. All negative command are formed by using the corresponding present subjunctive form:
--- 
¡No comas eso! 
¡No coma Ud. eso!
¡No comamos eso! 
¡No comáis eso! 
¡No coman Uds. eso!

Positive commands are formed as follows:

--- 
3rd person singular of present indicative
3rd person singular of present subjunctive
1st person plural of present subjunctive
Infinitive with -r replaced by -d
3rd person plural of present subjunctive

* -- Vosotros/as forms are used only in Spain. If a reflexive pronouns is added -d is dropped (¡Levantaos!). It is common to use infinitive itself as a command in colloquial speech.
 

--- 
¡Come! 
¡Coma!
¡Comamos! 
¡Comed! 
¡Coman!

Irregular commands:
 

decir 
hacer 
ir(se) 
poner 
salir 
ser 
tener 
venir
¡Di la verdad! 
¡Hazlo! 
¡Vete de aquí! 
¡Pon tu chaqueta en al armario! 
¡Sal inmediamente! 
¡ bueno! 
¡Ten cuidado! 
¡Ven aquí!
¡No digas nada! 
¡No hagas eso! 
¡No te vayas! 
¡No pongas el vaso allí! 
¡No salgas! 
¡No seas malo! 
¡No tengas miedo! 
¡No vengas todavía!
Check placement of pronouns with commands.

A summary of uses of subjunctive:
W
Wishes
Querían que los mirara (two subjects: ellos querían, él mirar). 
E
Emotions
Temen que les digas (two subjects: ellos temen, tú decir).
I
Impersonal Expressions
Es importante que recordemos.
R
Request
Requirement
Pidieron que les trajera (two subjects: ellos pidieron, yo traer).
No permitían que se escribiera en español.
D
Doubt
No creo que llueva mañana.
O
Ojalá
Ojalá que les interese el tema.

Detailed description:
[Influence][Emotion][Reflexives][Impersonals][Doubt][Unknown][Time][Conditions][..quiera][Although][Others]
A) With the following verbs to express influence or desire by one person upon another:

aconsejar que 
advertir que 
anhelar que 
desear que 
esperar que 
insistir en que 
permitir que 
preferir que 
prohibir que 
querer que 
recomendar que 
necesitar que 
ojalá que 
me/te/... aconsejar que 
me/te/... exigir que 
me/te/... pedir que 
me/te/... proponer que 
me/te/... recomendar que 
me/te/... rogar que 
me/te/... sugerir que 
me/te/... suplicar que
to advise 
to warn, advise 
to desire, long for 
to wish 
to hope 
to insist on 
to permit, allow 
to prefer 
to prohibit 
to want 
to recommend 
to need 
if only 
to advise 
to demand 
to ask, request 
to propose 
to recommend 
to beg 
to suggest 
to implore
B) To express emotion by one person upon another:
me 
te 
le 
nos 
les 
molesta que 
encanta que 
gusta que 
interesa que 
duele que 
preocupa que 
sorprende que 
alegra que 
da asco que 
da coraje que 
da tristeza que 
da gusto que 
da miedo que 
da pena que 
da vergu:enza que
to be 
to be delighted 
to be pleased 
to be interested 
to be sorry, hurt 
to be worried 
to be surprised 
to be glad 
to be sick (it sickens me) 
to be angered 
to be sad 
to be glad 
to be afraid 
to be sorry, hurt 
to be ashamed
    With the following phrases with estar and tener:
estar triste de que 
estar enojado de que 
estar feliz de que 
estar contento de que 
estar frustrado de que 
tener miedo de que 
tener la culpa de que
to be sad that 
to be angry that 
to be happy that 
to be content, satisfied that 
to be frustrated that 
to be afraid that 
to be to blame that
C) With the following reflexive verbs:
Sorprender(se) de que 
Preocupar(se) de que 
Alegrar(se) de que 
Enojar(se) de que 
Reír(se) de que
to be surprised 
to be worried 
to be glad 
to be angry 
to laugh at
    Although these seem to be identical to those in parts A and B, they are almost. Note conjugation and de
    Me sorprendo de que no puedan abrir la puerta. -- I am surprised that they cannot open the door. BUT!!!
    Me sorprenda que no puedan abrir la puerta. -- It surprises me that they cannot open the door.
D) With the following expressions (although impersonal these also express desire, advice, influence):
(no) es aconsejable que 
(no) es buena/mala idea que 
(no) es bueno/malo que 
(no) es importante que 
(no) es mejor que 
(no) es necesario que 
(no) es preciso que 
(no) es preferible que
it's (not) advisable 
it's (not) a good/bad idea 
it's (not) good/bad 
it's (not) important 
it's (not) better 
it's (not) necessary 
it's (not) necessary 
it's (not) preferable
E) To express doubt:
Tal vez 
Quizá 
Probablemente 
Posiblemente 
Acaso 
No + creer 
No + pensar 
No + decir 
No + opinar 
No + suponer
may be 
perhaps 
probably 
possibly 
by chance 
not believe 
not think 
not say 
not consider, think 
not suppose
    Also in questions: ¿Crees que llueva?
    The first 4 expressions can be used with indicative as well to indicate less doubt.
    It is rather confusing to use subjunctive with words like creer, pensar, dudar, estar seguro/a (de), negar. The rule is: when doubt or denial is being expressed then subjunctive is used:
No creo que sean estudiantes. BUT!Creo que son estudiantes.
    In the first case, the person is not sure, and thus even if they are really students, subjunctive should be used. In the second case, the person is sure, and thus even if they are not students, indicative should be used.
F) To describe the unknown or non-existent:
Buscamos una persona que nos enseñe a reciclar. We are looking for someone who can teach us recycle. (there may or may not exist such a preson)
Buscamos a la persona que nos enseña a reciclar. We are looking for the person who teaches recycling. (We know this person exists)
No encuentro nada que me guste. I can't find anything that I like.
G) With uncertain or future time:
Cuando 
Mientras 
En cuanto 
Antes (de) que 
Hasta que 
Despues (de) que
when 
while 
as soon as 
before 
until 
after
H) With conditions:
A menos que 
Para que 
Sin que 
Con tal (de) que 
A fin de que 
En caso (de) que
unless 
in order to (so that) 
without 
provided that 
so that 
in case of
I) Expresiones con quiera:
Quienquiera que 
Cuandoquiera que 
Dondequeira que 
Comoquiera que 
Cualquiera que
whoever 
whenever 
wherever 
however 
whatever
J) With aunque/although to express possibility of a future event: Aunque tenga dinero, no iré. -- Although I have money, I (probably) will not go. BUT!!! In a case of reality, use indicative: Aunque tengo dinero, no voy. -- Although I have money, I am not going.
K) Others:
Por ... que ?
    Por mucho que se alegre, no me importa.
    Por mucho que Ud. explique, no le va a hacer caso.
    Por atrevidos que sean no van a ganar la batalla.