The term to search here is "overflow". It really is one of the most important "features" of the game so it's good to understand it.
Normally any overflow (production, science, culture etc.) when you finish something is carried over to the next turn. So you're building a unit, you have 5 production left on it (75/80 for example) and your city produces 10 per turn. At the end of that turn your unit will be done and there will be 5 overflow which will be applied to whatever you choose to build starting on the next turn.
Similar thing for science and culture. When you finish a tech or civic, you will have some overflow science or culture from the previous turn.
The important thing to note is the bug/feature/misfeature where
if you receive any "instant" source of science or culture, it wipes out all the overflow for that yield. This applies to pillaging, Gorgo's culture on kill, doing anything to cause a eureka or inspiration etc. So if you pop a great scientist and finish a tech, the next turn you may have hundreds of science in overflow. DO NOT pillage a campus, build or upgrade a unit to get a boost etc. or ALL that overflow will be lost. The same applies to "regular" overflow from the previous turn - on the turn you have just finished a tech or civic, it's better not to do any pillaging, popping goody huts etc. because any overflow will be lost. It's a smaller amount so not as big a deal as great scientists, but hey, we like min maxing around here
As to how "instant" culture or science is applied - it's all applied at once, and any unused portion should be applied to the next thing you research starting next turn, subject to the above caveat. It's so easy to waste large amounts of overflow without thinking about it. Sometimes it's not even under your control. (You captured or built the Great Library; some other civ buys a Great Scientist and you get a eureka at some random time...)