Analysis of very simple algorithm I need to find the time complexity of the following simple algorithm.

Calculate the time complexity of the following algorithm:
void f(int n) {
  int i, x;

  for (i = 1; i &lt;= n; i++)
    if (i % 2 == 1)
      x++
}


It obvious that the time complexity of this algorithm is $\Theta(N)$, but how I prove it formally?
I know that the loop will do $N$ iterations, so the total number of operations will be $N \times \text{(number of operations inside the loop)}$.
Here the tricky part, I know that for each iteration will be one operation for the comparison and one operation only if $i$ is odd.
So it's something like this:
$\sum_{i=1}^{n}(1+\frac{1}{2})$? I'm not sure, it's seems too strange and I'm not sure how to continue.
What is the best way to write it formally?
Also, I would like to ask if there are books with many examples of analysis of simple algorithms like this and proofs of their complexity. The most recommended book seems to be CLRS, but I didn't found many examples of this kind there and from what I understand it can be very complex topic (depending on the series you need to calculate in the end).
Thank you.
One important thing to understand here is that the asymptotic analysis happens with respect to the parameters that are of interest to you. Here, for example, we are interested in the complexity with respect to the input $n$.

Typically, we assume that arithmetic operations (like the modulo or addition, etc) take a constant number of time. In a real system, one operation might indeed be more expensive than another. But, the important detail is that the time required by these operations does not depend on the input parameter $n$: it could be $1$, $100$, or $10^{\#\text{stars}}$, but it is still a constant as long as it does not scale with the parameter of interest.
So again, in summary, when we compute the asymptotic complexity of the function with respect to $n$, we can consider that all these operations take a constant time. 

Based on the above, the code inside the for-loop also takes a constant time. Whether the condition is true or not is irrelevant. If it is false it will take some constant time, and if it is true it will take again some constant time (maybe more than before, but still constant).
Hence, overall, the time for one iteration is $\Theta(1)$. 

Then, as you said, the overall complexity will be $\Theta(n) \cdot \Theta(1) = \Theta(n)$.