When do I need parentheses around an if statement to control the sequence of a formula in R?

An excellent question. From the R Language Definition:

Computation in R consists of sequentially evaluating statements. Statements, such as x<-1:10 or mean(y), can be separated by either a semi-colon or a new line.

Further, under if:

The if/else statement conditionally evaluates two statements. There is a condition which is evaluated and if the value is TRUE then the first statement is evaluated; otherwise the second statement will be evaluated. The if/else statement returns, as its value, the value of the statement that was selected. The formal syntax is

if ( statement1 )
    statement2
else
    statement3

The issue you encountered is that {1}+if(x==1){4}else{1} is a valid statement so R interprets this as statement3. In other words, from else, anything (within the block) up until a newline or a semicolon is only encountered when the if statement is FALSE.

Normally, in something like

if (y == 2) {
  4
} else {
  1
}

we understand that after the final brace, the if statement has finished, but it is the newline, not the closing brace, that signifies the end of the expression. For example, this does not create a

if (y == 2) {
  4
} else {
  1
} -> a

Second statement returns z/(4+4), ergo 0.5 and for the first statement, it evaluates only the first if() clause. Proof:

> z/(if(y==2){4}else{1}+if(x==1){4}else{3})
[1] 1