The reaction steps are reversible reactions and the reaction is driven to completion by removal of water e.g. by azeotropic distillation, molecular sieves or titanium tetrachloride. Primary amines react through an unstable hemiaminal intermediate which then splits off water. 
Secondary amines do not lose water easily because they do not have a proton available and instead they often react further to an aminal: 
or when an α-carbonyl proton is present to an enamine:
In acidic environment the reaction product is an iminium salt by loss of water.
This reaction type is found in many Heterocycle preparations for example the Povarov reaction and the Friedländer-synthesis to quinolines.