What is the difference between は and が ? when and how do we use these?
Roughly speaking, "wa" is a topic marker, and "ga" is a subject marker. The topic is often the same as the subject, but not necessary. The topic can be anything that a speaker wants to talk about (It can be an object, location or any other grammatical element). In this sense, it is similar to the English expressions, "As for ~" or "Speaking of ~."
Watashi wa gakusei desu. 私は学生です。 I am a student. (As for me, I am a student.) Nihongo wa omoshiroi desu. 日本語は面白いです。 Japanese is interesting. (Speaking of Japanese, it is interesting.)
"Wa" is used to mark something that has already been introduced into the conversation, or is familiar with both a speaker and a listener. (proper nouns, genetic names etc.) "Ga" is used when a situation or happening is just noticed or newly introduced. See the following example.
Mukashi mukashi, ojii-san ga sunde imashita. Ojii-san wa totemo shinsetsu deshita. 昔々、おじいさんが住んでいました。 おじいさんはとても親切でした。 Once upon a time, there lived an old man. He was very kind.
In the first sentence, "ojii-san" is introduced for the first time. It is the subject, not the topic. The second sentence describes about "ojii-san" that is previously mentioned. "Ojii-san" is now the topic, and is marked with "wa" instead of "ga."
There are many other usages also.