Anticipated and zero-lag synchronization have been observed in different scientific fields. In the brain, they might play a fundamental role in information processing, temporal coding and spatial attention. Recent numerical work on anticipated and zero-lag synchronization studied the role of delays. However, an analytical understanding of the conditions for these phenomena remains elusive. In this paper, we study both phenomena in systems with small delays. By performing a phase reduction and studying phase locked solutions, we uncover the functional relation between the delay, excitation and inhibition for the onset of anticipated synchronization in a sender-receiver-interneuron motif. In the case of zero-lag synchronization in a chain motif, we determine the stability conditions. These analytical solutions provide an excellent prediction of the phase-locked regimes of Hodgkin-Huxley models and Roessler oscillators.