A colleague of mine wrote a letter. "Thanks for the pension - I'm off then"
Seriously though the tone will depend a lot on you and whether you want to come back in the future or at least leave it open. If not something simple
Dear Personnel Department
I am writing to advise that I wish to take retirement from (date), as I will have passed 65 years of age.
I would like to thank (company) for your support over the last (Xx) years and would like to say I have enjoyed working here during that time. (Here you can thank certain people, which is sometimes nice i.e. - I would like to particular like to thank Mrs Jones my line manager who has been supportive and a friend during my time at (company name).