Aims. The aim of the present paper is to identify and study the properties and galactic content of groups and clusters in the GOODSSouth field up to z ∼ 2.5, and to analyse the physical properties of galaxies as a continuous function of environmental density up to high redshift. Methods. We used the deep (z 850 ∼ 26), multi-wavelength GOODS-MUSIC catalogue, which has a 15% of spectroscopic redshifts and accurate photometric redshifts for the remaining fraction. On these data, we applied a (2+1)D algorithm, previously developed by our group, that provides an adaptive estimate of the 3D density field. We supported our analysis with simulations to evaluate the purity and the completeness of the cluster catalogue produced by our algorithm. Results. We find several high-density peaks embedded in larger structures in the redshift range 0.4-2.5. From the analysis of their physical properties (mass profile, M 200 , σ v , L X , U − B vs. B diagram), we find that most of them are groups of galaxies, while two are poor clusters with masses a few times 10 14 M . For these two clusters we find from the Chandra 2Ms data an X-ray emission significantly lower than expected from their optical properties, suggesting that the two clusters are either not virialised or are gas poor. We find that the slope of the colour magnitude relation, for these groups and clusters, is constant at least up to z ∼ 1. We also analyse the dependence on environment of galaxy colours, luminosities, stellar masses, ages, and star formations. We find that galaxies in high-density regions are, on average, more luminous and massive than field galaxies up to z ∼ 2. The fraction of red galaxies increases with luminosity and with density up to z ∼ 1.2. At higher z this dependence on density disappears. The variation of galaxy properties as a function of redshift and density suggests that a significant change occurs at z ∼ 1.5-2.