Mostly through practice. There are some rules that you can look up, such as diminutives always being het-words ("de appel" - "het appeltje", "het brood" - "het broodje"), but aside from that, it's unfortunately all quite ambiguous and a fact of life when learning a lot of languages.
No. De-words are either masculine or feminine, and het-words are neuter. However, the difference between masculine and feminine words no longer 'lives' in standardized Dutch as it does in, for example, German. That's why de-words are often said to be of the common gender.