A Home Warranty Plan (or "residential service contract", as they are described technically) will possibly, upon failure of eligible systems and components of your home, provide for their repair or replacement. (Exceptions are covered in the policy.)
Some programs offer protection to the seller during the listing period and may be transferred to the new owner.
Most plans are a small cost when compared with the protection offered.
Plans may be purchased by either the buyer or the seller and can become a part of the contract negotiations, with the costs handled at the closing.
Be sure to read brochures describing coverage; each Home Warranty is a little bit different from the others; call the 800 numbers with questions.