Most of the great scientists believed in something, it was this along with the elixr of life, the philosophers stone, that drove them. However, for many their beliefs were not as laid out in religious texts ie a personal God. They believed that a universe that run on laws must have a lawgiver, there is no reason for the universe to run in an orderly fashion, you could wake up tomorrow and float up into the sky. Alchemy, masonry and science run parallell. The scientists disliked the oppression of the church, they had difficulties with museums. So they supported eachother in order to overcome the stuffiness.
Some of Darwins friends did not agree with his theory on Origin Of The Species but supported it in order to gain footing over the Church. This helped infiltrate The Royal Society and gain favour with the sovereign. In the time of the Reinnassance many supported the idea of Hermeticism, God Hermes and Egyptian God Thoth, the medicine symbol is still that of the caduceus. These were the beliefs of many of the mystic cults including the Freemasons which is said to go back to Solomons Temple. Oddily Freemasonry has become more mystical than it's origins of just certain handshakes to recognise the qualification of another mason. This may be because some members of The Age Of Enlightenment joint their order, their ideas were less pragmatic and more philosophical with regard to societal structure.
Darwins Grandfather greatly influenced Darwins idea. Especially in regards to a social Darwinism, Darwin was more intrigued by artificial evolution. Issac Newton was challenged by Tesla over his theory of Gravity. Tesla was one of the greatest scientist he invented technologies which we use today, mobile phones, microwaves, and at the time the "death ray." Many of his ideas were taken on his death. Tesla believed in a creator he also believed in eugenics, he could speak 9 different languages and was said to have a photographic memory inherited from his mother. Population growth and survival of the fittest were important to scientists, still are.
What may of aided their beliefs is many of their ideas came by way of dreams, visions and eureka moments, I'm pushed for space but here are a few.
Dimitri Mendeleev dreamt the periodic table.
Russel Wallace had a fever and dreamt about the theory of evolution. He was different to Darwin though, even though Darwin often quoted him. Wallace believed in a non material origin of higher mental faculties, he said that mathematics, artistic, musical, metaphysical, wit and humour set humans apart. He believed an unseen universal spirit had intervened 3 times, once in creation, once in the introduction of consciousness in higher species and once more in the mental faculties of humankind. Wallace also thought of a pure paper money system not backed by silver or gold. Interesting with regards to today's IOU's that are only valid when put back into the system.
August Kekule dreamt of Benzene molecules. He dreamt of dancing atoms, a snake swallowing its own tail, ie rings of carbon. Recognised as the Omborus
Srinivasa Ramanujan dreamt that a hindu goddess drew mathematical proofs for him. These turned out to be accurate.
Otto Loewi dreamt that it was chemical messengers that signal across synapses. This won him the Nobel Prize.
Louis Agassiz understood the structure of fossil fish by dreaming.
Rene Descartes dreamt of the basic scientific method. He was in the kitchen with his masonry heater when he had 3 visions from a divine spirit. Upon exiting these visions he formulated analytical geometry, which he believed the pursuit of science would be the pursuit of all wisdom. Descarte also believed in an evil demon, the deus deceptor.