Whether or not an object, such as an egg, floats is a function of its density relative to the medium it's submerged in. Objects that are less dense than their surroundings are buoyant and float. Objects that are denser than their surroundings sink.
There are two ways to get an object to float. The first is to lower its density, and the second is to raise the density of its surrounding medium. Tap water has a density of about 1 gram per cubic centimeter, and eggs are somewhat more dense than that. The density of an egg is more or less unchangeable, so getting it to float calls for denser water. The easiest way to do this is to add salt to the water until the egg becomes buoyant and begins to rise. By carefully adjusting the water's salinity, it is possible to adjust the height at which the egg holds steady.
Density can also be affected by temperature. As a rule, a cold medium is denser than a hot one. Warm water, therefore, is less dense than cold water and requires more salt to be added before the egg can float in it. Cold water, on the other hand, will support an egg at lower salinity.