How can the empirical formula of a compound be found?

And that's what $\text{empirical}$ means, i.e. $\text{experimental}$.
SO you get an accurate mass of your compound, which (even if it is an inorganic compound), will contain carbon and hydrogen as fixed percentages. And you combust the sample to give $C {O}_{2} \left(g\right)$ and ${H}_{2} O \left(g\right)$, and shunt the combustion gases down a gas chromatograph which will give the percentage by mass of carbon (as carbon dioxide), and of hydrogen, (as water).
WIth these data, using the atomic masses of carbon and hydrogen, you can address the $\text{empirical formula}$, the simplest whole number ratio defining constituent atoms in a species.