Oscillatory brain activity has been widely reported experimentally, yet its functional roles, if any, are still under debate. In this review we argue two things: firstly, thanks to oscillations, even slowly changing stimuli can be encoded in precise relative spike times, decodable by downstream "coincidence detector" neurons in a feedforward manner. Secondly, the required connectivity to do so can spontaneously emerge with spike timing-dependent plasticity (STDP), in an unsupervised manner. The key here is that a common oscillatory drive enables neurons to remain under a fluctuation-driven regime. In this regime spike time jitter does not accumulate and can thus be lower than the intrinsic timescales of stimulus fluctuations, which leads to so-called "temporal encoding". Furthermore, the oscillatory drive formats the spikes in discrete oversampling volleys, and the relative spike times between neurons indicate the eventual differences in their activation levels. The oversampling accelerates the STDP-based learning for downstream neurons. After learning, readout only takes one oscillatory cycle. Finally, we also discuss experimental evidence, and the question of how the theory is complementary to the so-called "communication through coherence" theory.