How is the search-and-rescue system for civil aviation over waters agreed and funded? Several accidents in the recent years have revealed how important --and intuitively expensive-- SAR operations over seas can be.


Need for daily government agencies / military flights in the first weeks after the accidents, need for underwater search.
SAR managed by other countries than the registration country of the aircraft.



Crewmembers of an Indonesian Air Force NAS 332 Super Puma helicopter over the Java Sea, Indonesia, 2015.Source

Without entering into too much details:


How is SAR for civil aircraft agreed globally?
Is that under ICAO umbrella?
Is it shared with maritime SAR or other organizations?
How is SAR responsibility shared between countries worldwide?Is a map with responsibility boundaries available?
How is SAR funded?
Are operators (their insurances) liable for costs?
Is it a service provided for free, if so to which extent?
How is the decision to stop active search taken?
Search and Rescue is under the ICAO umbrella, but also with the IMO. 

Annex 12 to the Convention on International Civil Aviation gives the international standards and recommended practices (SARPS) on Search and Rescue. 
The annex is supplemented by the International Aeronautical and Maritime Search and Rescue (IAMSAR) Manual, which is published by the International Maritime Organisation (IMO)

Together the documents describe:


The organisational structure of the worldwide SAR system concept,
including cooperation between states. (ICAO Annex 12, chapter 2, 3 &amp;
4, IAMSAR volume 1)
The operating procedures for organising and coordinating a SAR
mission (ICAO Annex 12, chapter 5, IAMSAR volume 2)
The operating procedures for those carrying participating in the SAR
mission (Appendix to ICAO Annex 12,  IAMSAR volume 3/ ICAO doc. 9731)


The details of implementing the SARPS are left to the states themselves.