A thymectomy is an operation to remove the thymus. It usually results in remission of myasthenia gravis with the help of medication including steroids. However, this remission may not be permanent. Thymectomy is indicated when thymoma are present in the thymus. Anecdotal evidence suggests MG patients with no evidence of thymoma may still benefit from thymectomy, thus the procedure is (unless and until a much-discussed clinical survey ever reaches a contraindicatory conclusion) commonly prescribed.
There are a number of surgical approaches to the removal of the thymus gland: transsternal (through the breast bone), transcervical (through a small neck incision), transthoracic (through one or both sides of the chest.)
The transsternal approach is most common and uses the same length-wise incision through the sternum (breast bone) used for most open-heart surgery. It is espoused by surgeons such as Alfred Jaretzki and is the most commonly performed procedure due to its relative simplicity.
The transcervical approach is a less invasive procedure that allows for removal of the entire thymus gland through a small neck incision. It has been popularized by Joel Cooper. Because of its increased technical demands, it is performed by only a relative few surgeons in North America: Joel Cooper (University of Pennsylvania; Philadelphia, Pennsylvania), M. Blair Marshall (Georgetown University; Washington, DC), Bryan Meyers (Washington University; St. Louis, Missouri), Stephen Cassivi (Mayo Clinic; Rochester, Minnesota), Sudhir Sundaresan (University of Ottawa; Ottawa, Canada), Shaf Keshavjee (University of Toronto; Toronto, Canada), Michael Rutter (Cincinnati Children's Hospital, Ohio), Helmut Unruh (University of Manitoba; Winnipeg, Manitoba); F. Sudish Murthy (The Cleveland Clinc, Cleveland Ohio).
Interestingly, there has been no difference in success in symptom improvement between the transsternal approach and the minimally invasive transcervical approach.
Video-assisted approaches, such as laparoscopic surgery, are increasingly prescribed since the less invasive nature of the procedure strikes a balance with the lack of actual clinical evidence supporting thymectomy in non-thymomal cases. 
A thymectomy is mainly carried out in an adult. This is because the thymus loses most of its functional capacity after adolescence, but does retain a small portion of its function during adulthood. This is shown in the decreasing size of the thymus with increasing age after adolescence.
The role of the thymus prior to adolescence is for the processing and maturation of thymocytes, which become T-lymphocytes and are released into the circulation. They then populate the lymphoid organs for storage until needed. Removal of the thymus as an adult has little immediate effect on the immune system as its role has been completed.