为了 (wèile) is most often used to indicate the purpose of an action, or the person that will benefit from some act of kindness. In the "purpose" sense, it corresponds pretty well to "in order to" or "for the purpose of" in English.
为了 as a preposition
When 为了 indicates the purpose of an action, it's usually acting as a preposition. In this role, the whole "为了 phrase" should come before the verb.
Note also that 为了 is a single word; the 了 here is not serving its role as a particle in this case.
Structure
为了+[some purpose],subject+predicate
Examples
为了 钱 , 他 出卖 了 朋友 。
为了 as a verb
Occasionally you will see 为了 acting as a verb by itself. In this case, it usually combines with 是, and the meaning is not hard to derive: "to be for."
Structure
subject+(是+)为了+objective
Example
我这么做 是 为了 你 。