Dynamics properties of piecewise homogeneous layers resting on elastic substrates: band gaps, localized modes and effect of prestress