Different from the common delayed synchronization (DS) that response appears after stimulation, anticipated synchronization (AS) in unidirectionally coupled neurons denotes a counterintuitive phenomenon that response of the receiver neuron appears before stimulation of the sender neuron, showing an interesting function of brain to anticipate the future. The dynamical mechanism for the AS remains unclear due to complex dynamics of inhibitory and excitatory modulations. In the present paper, the paradoxical roles of excitatory synapse and inhibitory autapse in the formation of AS are acquired. Firstly, in addition to the common roles that inhibitory modulation delays and excitatory modulation advances spike, paradoxical roles of excitatory stimulation to delay spike via type II phase response and of inhibitory autapse to advance spike are obtained in suitable parameter regions, extending the dynamics and functions of the excitatory and inhibitory modulations. Secondly, AS is related to the paradoxical roles of the excitatory and inhibitory modulations, presenting deep understandings to the AS. Inhibitory autapse induces spike of the receiver neuron advanced to appear before that of the sender neuron at first, and then excitatory synapse plays a delay role to prevent the spike further advanced, resulting in the AS as the advance and delay effects realize a dynamic balance. Last, inhibitory autapse with strong advance, middle advance, and weak advance and delay effects induces phase drift (spike of the receiver neuron advances continuously), AS, and DS, respectively, presenting comprehensive relationships between AS and other behaviors. The results present potential measures to modulate AS related to brain function.