Through a basic knowledge of gendered languages, mainly Latin and Greek. I really don't mean to be condescending, and I know it sounds like I do, but this whole controversy just smacks of ignorance of languages other than English, the same as the "petra/Petros" argument about Matthew 16:18. The word for "tablet" is feminine in Latin, but we don't refer to a tablet in English as "her."
Words that are closely related to people, e.g. occupations, do have correspondence between grammatical gender and personal gender: a servus is a slave, and can refer to either a slave in the general sense or to a male slave specifically; a serva is always a female slave. Words that are not closely related to people, like malleus, hammer, can be any grammatical gender, without affecting how we refer to them in English. The word for "spirit" falls into this latter category linguistically, even though in the unique case of God, the Holy Spirit is a person.