Late game the diplo lines are often quite entrenched meaning the -1 diplo hit you get for attcking someones friends often doesn't amount to much, and after you swallow up an empire or two you aren't really going to care about what other civs think about you anyway.
You do want to be aware of any defensive pacts, and if another neighbour dislikes you enough to declare during your war and cause trouble.
Attack when you have an decisive advantage in one or more of tech, numbers, or your planning.
The three of these can really open up in the lategame where you can really ramp up production to dedicate to units (the AI doesn't adjust to this), tech gaps lead to big differences in strength and abilities (Cuirassiers/Cannons/Rifling/Physics/Flight/Fission etc), and the AI really doesn't adapt well to the use of many late game units, in particular air units and nukes.
SamSniped said:
An optimal time to build your army is after getting your UU, too. Get all the techs for the UU, build an army with those and give it good supporting units. Example-if playing as France, use Flanking II Knights or Cuirs with your Musketeers instead of using Siege units to have a highly mobile army (this works on Warlord with enough Knights).
In the case of Musketeers you would probably stand to gain more by spending hammers on more Cuirassiers instead! They don't even need seige to smash pre-Rifling civs, if they need any help at all you can take spies.
UUs can help, but timing wars specifically for them is often far from 'optimal'. Numerous UUs such as Musketeers offer too little advantage to justify relying on them, others may be unavailable due to resource requirements, and at times even the best attacking UUs may be marginalised by circumstances.