A sectional residential flagpole is designed to come apart for exactly this reason, while a pole set in a concrete footing is effectively part of the property and almost never worth trying to extract. Figure out which type you have before you commit to a plan.
Pro tip: If you are leaving an in-ground pole behind, offer the sleeve cap and installation hardware to the new owner; it is a nice gesture and saves you from storing parts for a pole you no longer have.
Watch out: Never attempt to cut or force apart a sectional pole's threaded collar if it is stuck from corrosion; penetrating oil and a rubber mallet work far better than brute force, which can bend the aluminum out of round.