Through history, the systems of economic support for scientists and their work have been important determinants of the character and pace of scientific research. The ancient foundations of the sciences were driven by practical and religious concerns and or the pursuit of philosophy more generally. From the Middle Ages until the Age of Enlightenment, scholars sought various forms of noble and religious patronage or funded their own work through medical practice. In the 18th and 19th centuries, many disciplines began to professionalize, and both government-sponsored "prizes" and the first research professorships at universities drove scientific investigation. In the 20th century, a variety of sources, including government organizations, military funding, patent profits, corporate sponsorship, and private philanthropies, have shaped scientific research.
Most early advances in mathematics, astronomy and engineering were byproducts of more immediate and practical goals. Surveying and accounting needs drove ancient Egyptian, Babylonian, Chinese, and Indian mathematics, while calendars created for religious and agricultural purposes drove early astronomy.
Modern science owes much of its heritage to ancient Greek philosophers; influential work in astronomy, mechanics, geometry, medicine, and natural history was part of the general pursuit of philosophy. Architectural knowledge, especially in ancient Greece and Rome, also contributed to the development of mathematics, though the extent of the connection between architectural knowledge and more abstract mathematics and mechanics is unclear.
State policy has influenced the funding of public works and science for thousands of years, dating at least from the time of the Mohists, who inspired the study of logic during the period of the Hundred Schools of Thought, and the study of defensive fortifications during the Warring States period in China. General levies of labor and grain were collected to fund great public works in China, including the accumulation of grain for distribution in times of famine, for the building of levees to control flooding by the great rivers of China, for the building of canals and locks to connect rivers of China, some of which flowed in opposite directions to each other, and for the building of bridges across these rivers. These projects required a civil service, the scholars, some of whom demonstrated great mastery of hydraulics.
H. Floris Cohen's historiography of the scientific revolution (How Modern Science Came into the World) credits the Umayyad caliphates and especially the Abbasid caliphates support for the translation movement from the Greek, Persian, and Syriac literature to Arabic. These translations were undertaken by the library of the House of Wisdom in Bagdhad. Al-Kindi, Al-Battani, Ibn Sahl and Ibn al-Haytham flourished under the liberal policies of these caliphates.
Science in the Islamic world during the Middle Ages followed various models and modes of funding varied based primarily on scholars. It was extensive patronage and strong intellectual policies implemented by specific rulers that allowed scientific knowledge to develop in many areas. The most prominent example of this is with the Translation Movement of the ninth century that was facilitated by early Abbasid Caliphs. Other wealthy patrons also supported this movement and accelerated the process of acquiring, translating and interpreting ancient works of philosophy and science. Funding for translation was ongoing throughout the reign of certain caliphs, and it turned out that certain scholars became experts in the works they translated and in turn received further support for continuing to develop certain sciences. As these sciences received wider attention from the elite, more scholars were invited and funded to study particular sciences. Examples of translators and scholars who benefited from this type of support were al-Khawarizmi, Hunayn Ibn Ishaq and the Banu Musa. Patronage was primarily allocated to practical sciences which would be beneficial to the society at the time. Funding was reserved for those who were well versed in certain disciplines, and was not given based on religious affiliation. For this reason we find Jewish, Christian and mixed Muslim scholars working in Baghdad and other locations, often with one another.
A notable feature of many scholars working under Muslim rule in medieval times is that they were often polymaths. Examples include the work on Optics, Math and Astronomy of Ibn al-Haytham, or the work on Biology, Theology and Arabic literature of al-Jahiz. Many of these scholars were encouraged through patronage to take a multidisciplinary approach to their work and to dabble in multiple fields. Those individuals who were knowledgeable on a wide variety of subjects, especially practical topics, were respected and well-cared for in their societies.
Funding of science existed in many Muslim empires outside the Abbasids and continued even after the Mongol invasions into the Middle East. Results of patronage in Medieval Islamic areas include the House of Wisdom in Baghdad, the Al-Azhar University in Cairo, Bimaristans across the Middle East and Persia, and famous observatories, such at that of Ulugh Beg in Samarqand. It is also significant to note that later Muslim empires (Ottomans, Safavid, Mughal empires) also supported science in their own ways, even though there scientific achievements were not as prominent on a global level.
In Italy, Galileo noted that individual taxation of minute amounts could fund large sums to the State, which could then fund his research on the trajectory of cannonballs, noting that "each individual soldier was being paid from coin collected by a general tax of pennies and farthings, while even a million of gold would not suffice to pay the entire army."
In Great Britain, Lord Chancellor Sir Francis Bacon had a formative effect on science policy with his identification of "experiments of .. light, more penetrating into nature [than what others know]", which today we call the crucial experiment. Governmental approval of the Royal Society recognized a scientific community which exists to this day. British prizes for research spurred the development of an accurate, portable chronometer, which directly enabled reliable navigation and sailing on the high seas, and also funded Babbage's computer.
Most of the important astronomers and natural philosophers (as well as artists) in the 16th and 17th centuries depended on the patronage of powerful religious or political figures to fund their work. Patronage networks extended all the way from Emperors and Popes to regional nobles to artisans to peasants; even university positions were based to some extent on patronage. Scholarly careers in this period were driven by patronage, often starting in undistinguished universities or local schools or courts, and traveling closer or farther from centers of power as their fortunes rose and fell.
Patronage, and the desire for more, also shaped the work and publications of scientists. Effusive dedications to current or potential patrons can be found in almost every scholarly publication, while the interests of a patron in a specific topic was a strong incentive to pursue said topic--or reframe one's work in terms of it. Galileo, for example, first presented the telescope as a naval instrument to military- and commerce-focused Republic of Venice; when he sought the more prestigious patronage of the Medici court in Florence, he instead promoted the astronomical potential of the device (by naming the moons of Jupiter after the Medicis).
A scholar's patron not only supported his research financially, but also provided credibility by associating results with the authority of the patron. This function of patronage was gradually subsumed by scientific societies, which also initially drew upon their royal charters for authority but eventually came to be sources of credibility on their own.
Self-funding and independent wealth were also crucial funding sources for scientists, from the Renaissance at least until the late 19th century. Many scientists derived income from tangential but related activities: Galileo sold instruments; Kepler published horoscopes; Robert Hooke designed buildings and built watches; and most anatomists and natural historians practiced or taught medicine. Those with independent means were sometimes known as gentlemen scientists.
Military and commercial voyages, though not intended for scientific purposes, were especially important for the dramatic growth of natural historical knowledge during the "Age of Exploration." Scholars and nobles in seafaring nations, first Spain and Portugal followed Italy, France and England, amassed unprecedented collections of biological specimens in cabinets of curiosities, which galvanized interest in diversity and taxonomy.
Gradually, a science policy arose that ideas be as free as the air (air being a free good, not just a public good). Steven Johnson, in The invention of air (a 2008 book on Enlightenment Europe and America, especially on Joseph Priestley) quotes Jefferson: "That ideas should spread freely from one to another over the globe, for the moral and mutual instruction of man, and improvement of his condition, ... like the air ... incapable of confinement or exclusive appropriation." 
In the eighteenth and nineteenth centuries, as the pace of technological progress increased before and during the industrial revolution, most scientific and technological research was carried out by individual inventors using their own funds. For example, Joseph Priestley was a clergyman and educator, who spoke freely with others, especially those in his scientific community, including Benjamin Franklin, a self-made man who retired from the printing business. A system of patents was developed to allow inventors a period of time (often twenty years) to commercialise their inventions and recoup a profit, although in practice many found this difficult. The talents of an inventor are not those of a businessman, and there are many examples of inventors (e.g. Charles Goodyear) making rather little money from their work whilst others were able to market it.
The professionalization of science, begun in the nineteenth century, was further enabled by the creation of scientific organizations such as the National Academy of Sciences in 1863, the Kaiser Wilhelm Institute in 1911, and state funding of universities of their respective nations.
In the twentieth century, scientific and technological research became increasingly systematised, as corporations developed, and discovered that continuous investment in research and development could be a key element of success in a competitive strategy. It remained the case, however, that imitation by competitors - circumventing or simply flouting patents, especially those registered abroad - was often just as successful a strategy for companies focused on innovation in matters of organisation and production technique, or even in marketing. A classic example is that of Wilkinson Sword and Gillette in the disposable razor market, where the former has typically had the technological edge, and the latter the commercial one.
Swedish industrialist Alfred Nobel's will directed that his vast fortune be utilized to establish prizes in the scientific fields of medicine, physics and chemistry as well as literature and peace. The Nobel prize served to provide financial incentives for scientists, elevated leading scientists to unprecedented visibility, and provided an example for other philanthropists of the industrial era to provide private sources of funding for scientific research and education. Ironically, it was not an era of peace that followed, but rather wars fought on unprecedented international scale that led to expanded state interest in the funding of science.
The desire for more advanced weapons during World War I inspired significant investments in scientific research and applied engineering in both Germany and allied countries. World War II spawned even more widespread scientific research and engineering development in such fields as nuclear chemistry and nuclear physics as scientists raced to contribute to the development of radar, the proximity fuse, and the atomic bomb. In Germany, scientists such as Werner Heisenberg were being pushed by the leaders of the German war effort, including Adolf Hitler to evaluate the feasibility of developing atomic weapons in time for them to have an effect on the outcome of the war. Meanwhile, allied countries in the late 1930s and 1940s committed monumental resources to wartime scientific research. In the United States, these efforts were initially led by the National Defense Research Committee. Later, the Office of Scientific Research and Development, organized and administered by the MIT engineer Vannevar Bush, took up the effort of coordinating government efforts in support of science.
Following the United States entry into the second world war, the Manhattan Project emerged as a massive coordinated program to pursue development of nuclear weapons. Leading scientists such as Robert Oppenheimer, Glenn T. Seaborg, Enrico Fermi and Edward Teller were among the thousands of civilian scientists and engineers employed in the unprecedented wartime efforts. Entire communities were created to support the scientific and industrial aspects of the nuclear efforts in Los Alamos, New Mexico; Oak Ridge, Tennessee; the Hanford site in Washington and elsewhere. The Manhattan Project cost $1,889,604,000 of which $69,681,000 was dedicated to research and development. The Manhattan Project is regarded as a major milestone in the trend towards government funding of big science.
In the United States, the foundation for post-WWII science policy was laid out in Vannevar Bush's Science - the Endless Frontier, submitted to President Truman in 1945. Vannevar Bush was President Roosevelt's science advisor and became one of the most influential science advisors as in his essay, he pioneered how we decide on science policy today. Vannevar Bush, director of the office of scientific research and development for the U.S. government, wrote in July 1945 that "science is a proper concern of government"  This report led to the creation of the National Science Foundation in 1950 to support civilian scientific research.
During the Cold War era, the former Soviet Union invested heavily in science, attempting to match American achievements in nuclear science and its military and industrial applications. At the same time, the United States invested heavily in advancing its own nuclear research and development activities through a system of National laboratories managed by the newly formed Atomic Energy Commission in collaboration with the University of California, Berkeley and the Massachusetts Institute of Technology. This era of competition in science and weapons development was known as the arms race. In October 1957, the Soviet Union's successful launch of Sputnik spurred a strong reaction in the United States and a period of competition between the two new world superpowers in a space race. In reaction to Sputnik, President Eisenhower formed the President's Science Advisory Commission (PSAC). Its November 1960 report, "Scientific Progress, the Universities, and the Federal Government," was also known as the "Seaborg Report" after University of California, Berkeley Chancellor Glenn T. Seaborg, the 1951 Nobel Laureate in Chemistry. The Seaborg Report, which emphasized federal funding for science and pure research, is credited with influencing the federal policy towards academic science for the next eight years. PSAC member John Bardeen observed: "There was a time not long ago when science was so starved for funds that one could say almost any increase was desirable, but this is no longer true. We shall have to review our science budgets with particular care to [maintaining] a healthy rate of growth on a broad base and not see our efforts diverted into unprofitable channels." 
President John F. Kennedy's appointment of Seaborg as Chairman of the Atomic Energy Commission in 1961, put a respected scientist in a prominent government post where he could influence science policy for the next 11 years. In an address at Rice University in 1962, President Kennedy escalated the American commitment to the space program by identifying an important objective in the space race: "We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard." . Federal funding for both pure and applied research reached unprecedented levels as the era of Big Science continued throughout the Cold War, largely due to desires to win the arms race and space race, but also because of American desires to make advances in medicine.
Starting with the first Oil shock, an economic crisis hit the western world which made it more difficult for the states to maintain their uncritical funding of research and teaching. In the United Kingdom, the University Grants Committee started to lower their annual block grant for certain universities as soon as 1974. This was compounded by the access to power of the Thatcher government in 1979, who pledged a radical reduction of public spending. Between 1979 and 1981, more cuts in the block grant threatened universities and became opportunities seized by certain actors (heads of departments, vice-chancellors, etc.) for radical reorganisation and reorientation of the university's research. In 1970 in the United States, the Military Authorization Act forbade the DOD to support research unless it had "direct or apparent relationship to a specific military function." This cut the ability of the government to fund basic research.
In order to administer severely depleted resources in a (theoretically) transparent manner, several selectivity mechanisms were developed through the 1980s and 1990s. In the United Kingdom, the funding cuts of 1984-1986 were accompanied by an assessment of the quality of research. This was done by estimating outside research income (from Research Councils and private business), as well as "informed prejudice" by the experts on the UGC. This became the first Research Assessment Exercise, soon to be followed by many others.
In France, selectivity is exercised through various means. The CNRS evaluates regularly its units and researchers. For this reason, through the 1980s-90s, the government has attempted to privilege funding for researchers with a CNRS affiliation. With the creation of a contract system finalised in 1989, all research was submitted to approval of the university for inclusion in the contract passed with the Education Ministry. This allowed universities to select and privilege research and researchers they considered better than others (usually those associated to the CNRS or other grands corps de recherche).
Critics of selectivity systems decry their inherent biases. Many selectivity systems such as the RAE estimate the quality of research by its income (especially private income), and therefore favour expensive disciplines at the expense of cheap ones (see Matthew effect). They also favour more applied research (liable to attract business funding) at the expense of more fundamental science. These systems (as well as others such as bibliometry) are also open to abuse and fixing.
The European Union manages research funding through the Framework Programmes for Research and Technological Development.