Pulsars are neutron stars which spin rapidly and produce huge electromagnetic radiation along a narrow beam. Neutron stars are very dense, and have short, regular spins. This produces a very precise interval between pulses that range from roughly milliseconds to seconds for an individual pulsar. The pulse can only be seen if the Earth is close enough to the direction of the beam. Similar to how you can only see a lighthouse when the beam is shining at your direction.