It really depends on your task. What should be optimized and how are the variables related to that objective. An objective function consists of at least one of your variables that is subject to minimization or maximization respectively. In case it consists of multiple variables, they must only be related to one another by addition or subtraction. You can only multiply variables with parameters in a linear model.
Make sure your variables are defined to be bigger or equal to 0 (especially for minimization). The value zero often makes sense because you cannot have a negative amount of money, crops, ... but other lower bounds could also be possible. Also, every variable must have a certain ceiling assigned to it (especially for maximization). It must not be allowed to surpass a certain value.
By this you ensure, that the objective cannot develop towards +/- infinity.
Lastly an infinite amount of solutions could exist, rather than one. This you could check manually.
Hope that helps - even though very generic.
Given $x,y,z \geq 0$ and $x+y+2z \leq 1$, as far I see it, many objective functions are possible. The unique optimal solution of those resulting problems, however, would have to be one corner of the polyeder in figure 1.
The blue plane is the graphical representation of $x+y+2z \leq 1$. As $x,y,z \geq 0$, the axes also span sides of the polyeder. The result is this pyramid (figure 1). Which corner of it is the unique optimal solution (if there is one) depends on your objective. Objective functions could be:
$min$ $x+y+z$ (the optimal solution would be in the origin (0,0,0))
$max$ $x$ (the optimal solution would be (1,0,0))
$max$ $2x+y$ (the optimal solution would be (1,0,0))
$max$ $x+2y$ (the optimal solution would be (0,1,0))
$max$ $x+y$ (infinite solutions, which lie on the line (edge of the polyeder) confined by the plane, the x- and y-axis.)
Figure 1: Constraints