The phases of matter essentially rely on temperature. When temperature is added (endothermic) or taken away (exothermic), then it's molecular structure (it's atoms) act accordingly. When atoms are heated up, they move faster and farther apart. When they are cooled down, the move less and are more tightly packed together.