Hair is made up of overlapping 'plates'. Hair straightener weakens the links between these and allows the hair to be reshaped. Once the hair dries, the bonds between the plates are strengthened again, and the hair retains its relaxed shape. Not a very scientific answer, I admit, but that's the basic idea.