An Empty Water Heater
If the teenager of the household has been showering for the past hour, there's a pretty good chance the next person in the shower will start off with some hot water, only to end up making a shivering exit. As soon as all the hot water in the water heater has been depleted, it begins filling again with cold water, causing the water to turn from hot to ice cold. Wait a few hours for the water heater to replenish before attempting to enjoy a hot shower.
Cold Water Pressure Changes
Sudden changes in the shower water temperature are caused by pressure fluctuations. This happens when water gets used from the same water system. When cold water is used---for example, a toilet is flushed---the water pressure in the cold water pipes will dip. This will cause less cold water flowing to the shower valve, changing the lukewarm mix to hot water only.
Hot Water Pressure Changes
Pressure changes in the hot water pipes will have exactly the opposite effect. As soon as someone uses hot water somewhere in the same water system, the hot water pressure will drop, preventing hot water from reaching the shower valve and blasting you with ice cold water. To fix the pressure changes in your pipes, either change the pipes (installing a different size pipe may decrease pressure fluctuations) or install pressure valves to control the hot and cold water balance of your shower.