  Some globular clusters are observed to host a population of second generation
(SG) stars which show chemical anomalies and must have formed from gas
containing matter processed in the envelopes of first generation (FG) cluster
stars. We study the SG formation process by means of 1D hydrodynamical
simulations, assuming that the SG is formed by the gas ejected by AGB stars.
This gas collects in a cooling flow into the cluster core, where it forms a SG
star subsystem strongly concentrated in the cluster innermost regions with
structural properties largely independent of the FG initial properties. We also
present the results of a model in which pristine gas contributes to the SG
formation. In this model a very helium-rich SG population and one with a
moderate helium enrichment form; the resulting SG bimodal helium distribution
resembles that observed for SG stars in NGC 2808. By means of N-body
simulations, we study the two-population cluster dynamical evolution. In our
simulations, a large fraction of FG stars are lost early in the cluster
evolution due to the expansion and stripping of the cluster outer layers
resulting from early mass loss associated with FG SN ejecta. The SG population
is largely unscathed by this early mass loss, and this early evolution leads to
values of the SG to FG number ratio consistent with observations. We also
demonstrate possible evolutionary routes leading to the loss of most of the FG
population, leaving an SG-dominated cluster. Until mixing of the two
populations is complete, the radial profile of the SG to FG number ratio is
characterized by a flat inner part and a declining portion in the outer cluster
regions. (abridged)
