We see this from time to time. How do you fix a leaning pole? You need to dig a new foundation...

How do you remove a flagpole?
Removing a flagpole come down to the way it was installed initially. Standard flagpoles are set in sand, but many homemade flagpoles are set in concrete. If the flagpole is set in sand, you can vacuum out the sand and pull the pole straight out of the foundation sleeve. If the flagpole is set in concrete, you will most likely have to cut the flagpole at the base and fill the hole with dirt. If you are not trying to reuse the pole, it may be easier to cut it in sections.

The foundation should be a four (4) to six (6) times the size of the butt diameter of the flagpole. A three (3) inch butt diameter flagpole should have a 12 - 18 inch diameter hole. You also want to measure the ground sleeve base plate to make sure the hole is large enough uniformly down. Typically a form is used on the top of the foundation to help finish the base. This foundation tube shoudl be about four (4) times the height of the total length. 36" tube = ~9" form (exclude ground spike).