Theory of the photodetachment of negative ions in a magnetic field