When hexane is mixed with water, the two solvents separate into layers because they are immiscible, meaning they do not dissolve into each other. Hexane is a nonpolar solvent, while water is a polar solvent. Nonpolar solvents dissolve nonpolar solutes, while polar solvents dissolve polar solutes. Since hexane and water are not compatible, they form separate layers.
The density of hexane is 0.6603 g cm at 20c, which is lower than the density of water (1 g cm at 20c). Therefore, hexane will float on top of water when the two solvents are mixed.