Reconstruction of systems with delayed feedback: I. Theory