Your question is a bit vague, do you mean the formula for simple molecules (H2SO4 etc) or how you balance chemical equations. Much of this can be broke down into a few simple steps, for example ...
1) Memorise a reasonable number of simple chemical structures, water = H2O, Salt = NaCl etc using whatever method works best for you, flash cards, writing them out lots of times etc. This gives you a framework for what "other stuff" should look like when you see it for the 1st time.
2) Memorise the number of bonds particular atoms usually form, H = 1, C = 4 etc.
3) Learn simple rules for how atoms like to stick together and which ones like to get together in preference.
4) Learn how to balance chemical equations, the key part of which is that atoms are _conserved_ going from the left to the right hand side. E.g if I have CH4 + 2 O2 = CO2 + 2 H2O there are ... 4 Hydrogens, 4 oxygens and 1 carbon on _both_ sides, you are not allowed to gain or lose any atoms in a chemical equation.