So why would people who live on the coast pay for protecting people who live in land too? Why would the defense insurance cover everyone if not everyone pays?
Essentially, people would pay for their own defense [insurance], and it's kind of incidental if their money ends up protecting others as well. People on the coast would probably be willing to defend the people inland in the event of an air-based attack, even if they didn't "owe it to them"...but if they really wanted, they could always threaten to leave the heartland hanging out to dry if more of the protection companies there didn't start chipping in.

Seriously, just think about all the neocons today who are foaming at the mouth for more and more money to be spent on our gigantic empire: Do you really think the people in today's United States would not willingly spend the <1% of that number that it would actually take to reasonably defend the country from air-based attacks?
If you say no, I think you're really underestimating the willingness of people to voluntarily spend money. Think about all the money people spend on charity, even with the taxes we have today. If you've read
The Revolution: A Manifesto, you probably remember the page where Ron Paul mentioned the government's request for $121 million to be spent on the National Endowment for the Arts in 2006...and compared it to the private donations to the arts that year of $2.5
billion! Think about all the money people spend tipping waiters and waitresses - technically, it's not mandatory, but most people do it anyway because of the social expectation and their own feelings of fairness. I think defense is important enough that there would be a pretty big social expectation for people to chip in here as well. Heck, if a significant number of people considered defense technology to be extremely important, there would be public shaming of cheapskates who didn't pay their way. Companies run by more "hawkish" people who are serious about this may be so pissed that they wouldn't even hire anyone unwilling to help pay for defense. There are LOTS of ways to convince people to fork over their share of defense money without literally creating a state to take that money by force.

Plus, what people consider a fair amount of protection will always fluctuate from time to time based on geopolitical factors, so if people really start to legitimately fear attack by some foreign empire, they'll be much more eager to fork over their money.
Also, the coast vs. mainland issue is actually pretty moot due to the economic reasons people live on the coast in the first place: Port cities are
lucrative, because they're the hub of all international commerce. (Eventually, I think a lot of drinking water will come from desalination plants as well, and it will be much cheaper on the coasts than in some barren desert in the middle of the country.) The more people, companies, etc. refuse to live on the coast out of fear (and refusal to pay for protection to cover that fear), the less competition the companies there will have, and the more lucrative it will be to do business there, rewarding the companies who do and making defense insurance "a drop in the bucket." In other words, the economic bonuses of living closer to commercial hubs will pay for the defense insurance required.
And countries fight for resources, control, spheres of influence too, not because that country has an imperialistic foreign policy. Or just out of people being brainwashed into it through religion or other ways.
Well, fighting for resources, control, and spheres of influence with an anarcho-capitalist society essentially means fighting for control of land and waterways though. I think we both know that no country is going to invade an anarcho-capitalist society by land ("a rifle behind every blade of grass" and all that)...but if they were really so brainwashed that they'd do it anyway, they're free to come and be slaughtered. We could always sell their flesh and organs as delicacies on the international market (okay, bad joke).
When it comes to waterways, that's somewhat trickier. Because an anarcho-capitalist society would have such an efficient economy, its companies would be selling goods at extremely low prices. Most other countries would WANT to trade with them, and those countries would need the anarcho-capitalist society as a trading partner far more than vice-versa. If one troublesome nation decided to create some kind of blockade or take out merchant ships - whether for control, out of spite, or for psychotic religious reasons - other countries' economies would be so negatively affected that they'd likely consider it an attack on themselves and therefore intervene (unless the aggressor was a completely dominant empire). Otherwise, well - anarcho-capitalist courts aren't exactly going to condemn heavily-armed merchant ships traveling in large packs who fight back against a hostile foreign navy. Moreover, the hostile country's ships would probably be considered free game for pirates. What anarcho-capitalist jury is going to convict pirates in an anarcho-capitalist court for attacking the ships of a country that is maliciously attacking the anarcho-capitalist society's merchant ships? With a virtual guarantee that the pirates attacking a hostile country's ships will not be convicted or extradited, that would create a whoooole lot of incentive for people to turn pirate.

Seriously, if people think the problem with mere Somalian pirates is bad, no country in their right mind would ever dare face the consequences of waging war on an anarcho-capitalist society's peaceful merchant ships...especially if the society spans a geographical area even a fraction of the size of the current United States. (To clarify: Of course, piracy would not be permitted under ordinary circumstances, and extradition of criminals would be just as commonplace as today to avoid unnecessary conflict. After all, allowing piracy across the board would not only be antithetical to the principles of a libertarian society, but it would also give every country in the world a constant economic incentive to launch an invasion.)
If some nation ever wanted to launch some sustained attack on peaceful anarcho-capitalists - which would be an insane loss of money without any economic benefit, but let's assume they did, because people are crazy like that - the people of an anarcho-capitalist society would be just as pissed off and ready to fight back as the people anywhere else...and considering the strength an anarcho-capitalist economy would have, they'd have a significant economic advantage. You'd see militias organizing and gearing up to go kick some ass, weapons companies ramping up manufacturing like crazy, and social pressure to fund the defense effort among the populace similar to the pressure to buy "war bonds" during the World Wars. Just because the people wouldn't have a state to worship doesn't mean they would have no pride or dignity, or that they would take abuse lying down.

Interestingly, I think that despite not having state-worship, an entirely free society would still have its own brand of "national pride" develop (minus the nation part), because the fiercely independent people would recognize their uniquely free situation in the world and be unwilling to let any usurper take it away from them.
Finally, in the extremely unlikely event that foreign armies might actually defeat the anarcho-capitalists...they'd
still have a hell of a time occupying the country and setting up a state, because there would be no existing state apparatus to take over that any of the people recognized as legitimate! It wouldn't be impossible to do, but it would take considerably more effort than it would take to overthrow a nation of similar geographical area and population and install a puppet government there. The British eventually overthrow the essentially anarchist system in Ireland and established a state...but it literally took them
centuries to do it.