system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do companies with secret formula keep it secret when producing a product?

For example, Coca-Cola has a secret recipe that are only known to few employees.

So, how do they keep it secret when making Coca-Cola in a factory? How do they bring the ingredients to factory without anyone knowing what was in it?
gpt
I work in the consumer cosmetics industry.  Pretty much what the other poster's link said, it's mostly done with lawyers and ironclad non-disclosures and non-competes.  We do jobs for multiple cosmetics companies and we're forbidden to let visitors from one company see products being made for any other company.  They're always escorted thru the building by one of us at all times.  

Additionally, you can have the batch broken up into phases and have them made in different places and/or by different people and combined later.  That way nobody knows all of it.  We commonly get containers of "ingredient x" that's not really a single raw (chemical) but a mixture that's proprietary and made somewhere else.  It's usually not the whole thing that's secret, it's just one secret ingredient.  To use your coke example, it's no big secret that it's mostly carbonated water and sweetener.  That's probably 95% of the batch right there, and the carmel color could easily be copied by experimentation.  The key is the very small trace ingredients that make Coke taste like coke.  The flavorings are probably 1% of the total mixture.  So at the factory, they can have the whole batch recipe, with just one line item that says "magic flavor" or whatever and that is just some liquid that they receive in a can and pour in at the right time.

Also, don't patent something you want to keep secret.  Getting a patent requires full disclosure of the whole process.