In H2O, the hydrogen atom is attached to a highly electronegative atom and thus, the elecron shifts towards the O atom and the result is a highly polarised H+ atom.
In NaH, the H atom is attached to a highly electropositive element that has a high tendency to lose an electron, which is gained by the H atom. Thus, H− ion is formed.
In CH4, C and H are of similar electronegativities and thus, both share their electrons, forming a covalent bond and remain neutral.