The treatment of alcohols with mineral acids at high temperatures causes the loss of water, which occurs through E1 or E2 mechanisms.

Under the reaction conditions, it is observed that the tertiary alcohols dehydrate better than the secondary ones, and these in turn better than the primary ones.
Mechanism for dehydration of primary alcohols
Primary alcohols dehydrate via the E2 mechanism.
Dehydration mechanism of secondary or tertiary alcohols
Secondary and tertiary alcohols form stable carbocations by loss of a water molecule after protonation of the hydroxyl group. The formed carbocation generates the alkene by loss of a proton.