The 2 major possible geometries of ammonia are D3h and C3v, but it prefers C3v. My thought process is that this is simply Walsh's rule - the HOMO in C3v is bonding (2A1), whereas the HOMO in C3v is non-bonding (1A2''), so the molecule prefers the trigonal pyramidal geometry based on the HOMO being best-stabilised.
Is this the complete explanation or does the 2nd order Jahn-Teller distortion come into effect here too?
I included a Walsh diagram for PH3 (couldn't find one for ammonia) just for completeness' sake.