了is one of the most commonly encountered grammar particles in the modern Chinese language and also one of the most difficult to grasp. The particle 了 can have many different functions in a sentence. Here are the most basic uses to get you started:
Completed action:
了 can be used after a verb to indicate that the action has been completed. This is the most common use of the particle 了。
For example:
我去了图书馆 - I went to the cinema
我买了一支笔 - I bought a pen
The sentence structure is subject+verb+了+object
Change of state:
了 can also be used to indicate a new situation has arised.
For example:
下雨了 - it's raining (indicating that is wasn't raining before)
你胖了 - you're fat (indicating that you weren't fat before)
Indicating immediacy:
了 can also be used at the end of a sentence to indicate that is something is about to happen. With this use, 了 often corresponds with something else preceding the verb to indicate immediacy, such as '快', '快要' or '就要'
For example:
他快去中國了 - He's going to China very soon
我就要離開我的家了 - I'm just about to leave my house
了 is often wrongly presented as the past tense particle - in fact, it can be used in the past, present and future tenses.
For example,
他吃了飯以後會去圖書館學習 - After he has eaten he will go to the library to study
- in this sentence, the particle 了 is being used to indicate a completed action which will take place in the future