Nonlinear dynamics and machine learning of recurrent spiking neural networks