This is an instructive video on the double slit experiment with photons which is experimenting with single photons. At about 2.5 minutes it explains how the experiment is done with single photons. In a nutshell, by lowering the intensity of a light source to the point of zero emitted by the source and then slowly increasing it.
The detection hinges on the detector of single photons, in this case a photo multiplier. Photo multipliers work by multiplying the input from a single hit into an avalanche that is detectable electronically. For this detector since it has not been isolated from cosmic rays a noise background exists.
If one googles "single photon detectors" a number of commercial detectors come up, using different techniques. One can choose a detector that will fulfill the accuracies necessary in his/her experimental needs.