His last years were spent in France.
At the age of 60, political unrest compelled Leonardo to leave Milan. This brought him to Rome, where he was welcomed by Giuliano de Medici, the Pope's brother. While other painters like Raphael and Michelangelo were working diligently on commissions for the Pope, Leonardo was just granted a stipend and left to his own devices while trying to find employment in Rome.
As a result of his intense frustration, Leonardo left Italy permanently in 1515, five years after Francis I of France gave him the position of "Premier Painter, Engineer, and Architect to the King." Leonardo da Vinci spent the latter years of his life in France where he worked as a painter, architect, and engineer under King Francis I. When Leonardo moved to France, he was free to pursue his interests however he pleased, although he continued to assist the monarch in creating festivals and gardens.
Until the end of his life, Leonardo spent his days in his manor, Cloux, relaxing. When Leonardo passed away in 1519, he left his land to one of his students named Francesco Melzi. He was then buried at the neighboring church of St. Florentin. Sadly, the church was destroyed in 1802 due to damage sustained during the French Revolution. Historians have found it challenging to locate his remains since some of the graves were also damaged. But in 1863, after a team of archaeologists excavated remnants of Leonardo's burial, his gravesite was located. Then, his bones were transferred to St. Hubert, where they still lie today.