Most of our behaviors develop due to the emergence activity of separate neural networks in different parts of our brain. In each network, neurons often obtain the ability to perform an activity by learning it. But in neural networks which have mostly erratic behavior, the condition of learning and making complex movements with minimal error still remains as a question. In this thesis, this issue will be discussed that how a simple neuron can learn a repeating pattern and begin to reproduce that pattern as well. To study that, Using simulations, we have first shown that, thanks to the physiological learning mechanism referred to as spike timing-dependent plasticity (STDP), a neuron can detect and learn repeating spike patterns, in an unsupervised manner. Importantly, the spike patterns do not need to repeat exactly: it also works when only a firing probability pattern repeats. These generic STDP-based mechanisms are probably at work, in particular, the visual system, where they can explain how selectivity to visual primitives emerges, leading to efficient object recognition systems.