Turbulent entrainment at the turbulent/non-turbulent interface (TNTI) plays an important role in understanding the turbulent diffusion. While entrainment in fully developed canonical turbulent flows has been extensively studied, the evolution of entrainment in spatially developing flows remains poorly understood. In this work, characteristics of entrainment and the effect of vortices on entrainment of the shear layer separated from a wall-mounted fence are studied by the experiment in a water channel. The shedding vortex experiences a series of stages, including generation, growth, deformation and breakdown into smaller vortices. With the development of the flow, entrainment varies correspondingly. The prograde vortex near the TNTI is found to suppress entrainment but have little effect on the detrainment process, while the retrograde vortex promotes entrainment and suppresses detrainment as well. Consequently, the local entrainment velocity is decreased by the prograde vortex and increased more significantly by the retrograde vortex. Along the streamwise direction, the time-mean entrainment velocity is smallest where the prograde vortex is strongest in the vortex deformation stage. However, the largest time-mean entrainment velocity is located where the enstrophy gradient near the TNTI is greatest after reattachment, rather than where the retrograde vortex is strongest shortly after the breakdown of the shedding vortex, because the scarcity of retrograde vortices in the vicinity of the TNTI makes their long-time cumulative contribution not as significant as their local enhancement. The present study reveals how entrainment evolves in the separated and reattaching flow, and improves our understanding of the effect of vortices on entrainment.