A mezuzah is affixed on the right doorpost, at the bottom of the top third of the doorpost.
For the front door, the right doorpost is the doorpost to the right of the person entering from the street. In internal doorways, it is the doorpost to the right of a person entering in the direction towards which the door opens. If there is no door, think about importance and function: the dining room is more important in the hierarchy of the home (it's used more formally) than the kitchen, so in a doorway the dinning room and the kitchen the mezuzah should be on the right of the person entering the dining room.
To determine the proper height at which to affix the mezuzah, use a measuring tape to get the total height of the doorpost. Divide it into three, and measure that amount from the top of your doorpost. Use a pencil to mark the spot; you will attach your mezuzah directly above that mark (see illustration).