How do the three states of matter change?
Matter changes phases via the addition or removal of heat.
and vice versa
Matter changes phases (states) by either addition or removal of heat. For example, adding heat to ice causes it to melt. This creates water, a liquid. If you add even more heat, then the water will evaporate and become vapor, a gas.
Conversely, if you remove heat from gas, it will reverse back to a liquid (i.e. rainfall occurs in low temperatures); removing more will cause the liquid to freeze into a solid (i.e. ice on a winter day).
There are cases where a substance will skip the liquid phase and transition directly to gas when heat is added; this is called sublimation. Reversing the process is called deposition/desublimation.