了 has two main uses: (1) After a verb, it marks a completed action: 我吃了饭 (I ate). (2) At the end of a sentence, it signals a change of state or new situation: 下雨了 (It's raining now / It started raining). These can overlap in the same sentence.
mistakes
了 does NOT mean past tense. It marks completion or change, which can happen in the future too: 你到了北京,给我打电话 (When you arrive in Beijing, call me). Don't add 了 to every past event — habitual actions don't use it: 我以前每天跑步 (I used to run every day) — no 了.
grammar
To negate a completed action, use 没(有) and DROP the 了: 我没吃饭 (I didn't eat), NOT 我没吃了饭. The 没 already implies non-completion, so 了 becomes redundant.