Does a country have the legal right to shoot any military or spy planes down as long as it flies in its airspace? I am wondering about this, what about suspected planes from private companies or other countries. Can a private company or country sue for damage? Let's assume the country is the United States.
What you're looking for is a convention, in international law, that governs international aviation, the Chicago Convention on International Civil Aviation. Article 3 says
(a) This Convention shall be applicable only to civil aircraft, and shall not be applicable to state aircraft.
(b) Aircraft used in military, customs and police services shall be deemed to be state aircraft.
(c) No state aircraft of a contracting State shall fly over the territory of another State or land thereon without authorization by a special agreement or otherwise, and in accordance with the terms thereof.
Article 1 also says that
The contracting States recognize that every State has complete and exclusive sovereignty over the airspace above its territory
There is no separate international law governing the treatment of state aircraft entering the airspace of a nation without permission: the convention is entirely about protecting civil aircraft. From the recognition of sovereignty of the nation over its airspace and the absence of provisions protecting state aircraft, you may conclude that a nation has the "right" to shoot down state aircraft over-flying without permission. There are rules to the effect that a civil aircraft may be required to land, as opposed to shooting it down.
An aircraft operated by a private company (e.g. Delta airlines) might sue the government of a nation that shot its plane out of the sky, in contravention of the convention. However, the convention does not create a right to sue a government, so if a civil aircraft were shot down for incursion into a nation's airspace, there may or may not be a right to sue depending on the law of the relevant nations. In the case of the shootdown of Ukraine International Airlines Flight 752, a lawsuit has been filed against Iran, in Ontario Superior Court. Given sovereign immunity, it is generally unlikely that a government can be successfully sued for shooting down a civil aircraft, unless there is a law allowing such lawsuits (like the US Federal Tort Claims Act)