Retirement was a period in an individual's life where they withdrew partially or completely from one's primary position or career. A person was considered to be semi-retired when they only partially withdrew from their career.
Individuals retired due to a desire to cease working for personal reasons. Health reasons were another reason for individuals to retire. Retirement could be voluntary or mandatory.
In the mid 23rd century Starfleet had a mandatory retirement age for humans of 75. (TAS episode: "The Counter-Clock Incident"). By the 24th century this policy had been rescinded, with a number of human officers serving well past the age of 75. Such officers included Pavel Chekov, Hikaru Sulu, Elias Vaughn, Leonard McCoy, John Harriman, and Jean-Luc Picard.
Several years after the massacre on Tarsus IV Donovan Eames retired from his position as the New Anchorage Hospital system. Following his retirement Eames and his wife Imani moved to Benecia. (DSC novel: Drastic Measures)
In the 2260s Ambassador Sarek briefly retired due to health concerns. Doctor Leonard McCoy noted it was unusual for him to retire due to his only being 102 years old at the time. (TOS episode: "Journey to Babel") After his health concerns were treated Sarek returned to work, and served the Federation for over 100 years before retiring in 2367. (TNG episode: "Sarek")
James T. Kirk retired from Starfleet some time prior to 2284. However he found retirement unfulfilling and soon returned to Starfleet. Following the Khitomer Conference he retired again from the service. (TNG movie: Generations and TOS movie: The Undiscovered Country)