The advantage of hydrazine as a rocket fuel is its high energy per unit weight available from its decomposition. The decomposition products are nitrogen, and a relatively large amount of the desired hydrogen. Also, since hydrazine is a liquid at STP, it is preferred over the storage of gaseous or (cryogenic) liquid hydrogen.

Hydrazine is a bifunctional base, forming hydrazinium salts when reacted with water:

N2H4(aq) + H2O = N2H5+ + OH-
N2H5+(aq) + H2O = N2H62+ + OH-

Anhydrous hydrazine is a remarkably stable chemical compound, but its combustion in air generates an enormous amount of heat: approximately 622 kJ.mol-1

As m_turner writes, the synthesis of hydrazine is done by the reaction of ammonia with sodium hypochlorite:

NH3 + NaOCl → NaOH + NH2Cl (Fast reaction step)
NH3 + NH2Cl +NaOH → N2H4 + NaCl + H2O

However the problem is that there is a fast competing reaction:

2 NH2Cl + N2H4 → 2 NH4Cl + N2

In order to increase the hydrazine yield, gelatin is added to sequester trace amounts of heavy metal ions that catalyze the competing reaction.

ONE BIG WORD OF WARNING: Hydrazine is a seriously toxic compound. This is the description on the label (and that's just the diluted, aqueous form of hydrazine):

Highly toxic! Sensitizer! Corrosive! Mutagen! Cancer suspect agent! Readily absorbed through skin! Target organ: liver, kidneys! Target organ: blood, nerves!

(with exclamation marks and all). Trust me, that information is not exaggerated in any way. If you ever have to work with this compound, read the MSDS, wear all the proper safety gear, and work in a fume hood. Hydrazine is immediately dangerous to life and health at concentrations over 80 ppm.

The health danger is another reason why NASA wants to replace hydrazine as rocket fuel