Damn good question. Nerve fibres seem to grow by a mix of trial and error, then the ones that make the 'good' connections get signals sent down them which reinforces the connection, 'bad' ones dont. As to making the system go wrong ... most signalling is electrochemical, so chemical interference can be a factor ... basically, though no-one knows exactly how the axon growth is triggered or steered.