Chinese don’t say 你好! as often as foreigners do because it is pragmatically not the equivalent of Hello, but rather How do you do? This is the greeting which is used commonly at the first time meeting, e.g., you are just introduced to each other. We also say it to call attention to a stranger when we don’t know how to address him/her, e.g., when you want to ask about the price of something: 你好，请问这个多少钱？
Chinese people never say 你好吗? which is the literal translation of How are you? or Wie geht es…? after the habit of westerners. It is usually arranged in the first few lessons of almost all Chinese-as-a-Foreign-Language textbooks for the convenience of structure teaching and for the communicative need. Why? Because both the question and answer belong to typical adj-predicate sentence patterns used exclusively in Chinese.
Instead, the Chinese use many other contextualized expressions concerning life situations to greet others. It is not, as misunderstood by many foreigners, that the Chinese tend to inquire about others’ privacy, but it’s just the way we Chinese people show our care and concern naturally in how we greet. Typical greetings of this kind are:
Did you have the meal (breakfast/lunch/dinner)? 吃(早饭/午饭/晚饭)了吗?
It’s a bit old-fashioned and commonly used among people who meet often and know each other well, such as during or not long after normal meal times, i.e., as when neighbors meet while taking a walk in the park or as when students living in the same dormitory building come across each other.
This kind of greeting sounds more often an unnecessary repetition of something obviously happening in the moment, but it’s actually not unnecessary at all. 去哪呀 — I may say this after hi as a greeting when I see a friend coming out of the college, not really concerned about where she is going, and she doesn’t have to answer this question in detail. You may also say 去上班啦？(going to work?) with either rising or falling tone, when you see a neighbor on his way to the bus station in the morning, or 在干嘛那 (a very vocal way saying what are you doing there?) when you would like to start a conversation with a friend on Facebook, or sitting right beside you.
The expression most similar to 你好吗 is probably 最近怎么样?/最近好吗? which means How are you lately/recently? Although with just one more word 最近 added in, it sounds much more authentic and is thus used more often. You can say that when you haven’t seen or talked to someone for a while, usually at least one week, and ask generally about the person’s latest situation, or simply as an icebreaker or starter of a conversation/letter/email. More specifically, it could be 最近身体怎么样？usually to senior citizens or someone who has had health problems, or 最近工作怎么样? The replies are all the same as those to 你好吗? as you might have learned. 最近 can also be replaced by other adverbials indicating time, according to the specific situation, such as 这周, 这几天, 上个月 and the like.
In a word, greetings in China are highly contextualized. Any situation at the moment could be developed into a greeting or small talk.
If you don’t want to–no time or need–to go any further but just say Hi with due respect, indicating that you have noticed someone, the title +好 or simply the title is enough. For example, if you bump into your professor or boss once in a while in the corridor, you may say 教授好! 陈总早! for the first time, but later just 张教授！陈总！with a nod or smile. 总 used to stand for 总经理 (general manager) but now the family name + 总 can refer to many similar titles/positions, such as supervisors, a CEO or just your boss.
China is becoming increasingly international, and more people speak English now. Among young people, Hi/Hello is frequently used, just as many use 拜拜 (pronounced just as bye bye) instead of 再见. Equivalents of Good morning/afternoon/evening! 早上好/下午好/晚上好 are also quite commonly heard, especially in companies. For example, 早! (Morning!) might be the most simple word for a foreign learner to say as a greeting in the morning. It is also a concise and effective word which makes you sound professional and authentic. But we don’t have Good day! like that in German and some other languages.
Last but not least, there’s certainly no need to memorize these rules of pragmatics once and for all. Your sincere attitude is most important, in my opinion, and once you are in that environment full of Chinese, this is something you’ll pick up naturally in the context. But if you have a higher requirement of yourself and feel like learning and speaking authentically from the very beginning, the above are some tips for you.