Why is it OH- and not HO-? I am told that in a chemical equation the metal comes first and then the non metal. for example MgO, ZnSO4,etc. But when both the elements are non metals or metals, the one with the lower atomic number would come first. for example:- H2O,CO2,HF,etc. But why is it that hydroxide is OH- and not HO-? Also why is methane CH4 and not H4C?
OH- and HO- are both acceptable.  The charge is on the oxygen, of course.  One can argue cation then anion (salts) versus alphabetical (e.g., AuBe, which is brittle and weak rather than ductile, suggesting ionicity).

Organic formulas are C, H, then alphabetical.  Order may be altered to conform to structure (e.g., propane as $\ce{H3CCH2CH3}$) or convenience $\ce{H3C^{-}Li^{+}}$ (which is nowhere near the real structure of methyllithium, but is how it reacts).