Purpose: um … zu or damit
Use um … zu for a purpose when the understood subject is shared. Damit introduces a purpose clause with its own subject and a finite verb at the end. It also works when the subjects are the same.
Understand the idea
Purpose explains the intended goal of an action. German offers a useful contrast between an infinitive purpose phrase and a full clause with its own subject. The intended action need not actually succeed for the purpose construction to be appropriate.
Build it step by step
Use um … zu when the understood actor of the purpose is shared with the main clause. Use damit when you need an explicit subject, particularly a different actor. Damit introduces a verb-final clause. A separable infinitive places zu inside the word. With either pattern, keep the goal distinct from a cause introduced by weil.
See it in a sentence
Ich lerne viel, um die Prüfung zu bestehen.
Er spart Geld, um ein Fahrrad zu kaufen.
A useful memory aid
Ask who is meant to perform the purpose action. A change of actor is a strong signal that a full damit-clause is needed.
A common trap
Do not give an um … zu phrase its own independent subject. Also avoid replacing purpose with because when explaining an intended result.