The term 'desexing' is a little misleading. Your pet will not lose their gender; they will remain male or female after the procedure. They will just be sterilized, which means they cannot breed.
At most vet clinics, surgical sterilization involves removal of the uterus and ovaries for females in a procedure called an ovariohysterectomy, and the removal of the testes for males in a procedure called an orchidectomy. More commonly, the procedures are known as a 'spey' for females, and a 'castrate' for males.
Desexing male dogs: A common misconception is that during a castrate, the vet will remove the scrotum and the testes together. This doesn't occur. Unless your dog is particularly mature, or has a problem with his scrotal skin, there is no point removing the scrotal skin as this causes unnecessary tissue damage and creates a much longer healing time. Instead, your vet will make a small nick in the skin in front of the scrotum, gently squeeze the teste through the small hole, and remove them efficiently and swiftly. For the most part, desexing a male is relatively quick, minimally invasive, and not very painful.
Desexing Female Dogs: For females, the procedure is longer and a little more serious as it involves going into the abdominal cavity. A common misconception is that the smaller the incision line, the better the procedure. This is true to some extent - more experienced surgeons tend to use smaller incision lines than recent graduates - however, a larger incision line can be good as it means the surgeon has much better visibility, and can control any potential problems a lot quicker. Many experienced vets make a point to make a larger incision line as a precaution in case anything goes wrong.
Whilst traditional spey procedures are still very much the norm, laparoscopic desexing for dogs has been developed and is performed in some vet clinics. Laparoscopic desexing differs from the traditional method in that the vessels and ligaments of the reproductive system do not have to be exteriorised during the procedure, allowing a much smaller incision to be made, less disturbance of the abdominal wall and organs, reduced risk of bleeding and infection, and reduced pain post-operatively.
Desexing Male Cats: Of all the desexing procedures, castrating male cats is the quickest and least invasive. Your vet will make a small incision over the skin of the scrotum, squeeze the testes through, tie off the spermatic cords, and remove the testes. Sutures are not usually placed, as they are not required.
Desexing Female Cats: The procedure for desexing female cats is the same as that for female dogs, though can tend to be a little quicker due to their smaller size. Cats are particularly adept at removing their incision line sutures, so your vet may place intradermal sutures (within the skin) to prevent this from happening.