It might help if you break the numbers down into thousands, hundreds, tens and units.
Here are some examples to help you follow the rules:
What number is "XII"?
Using rule number one, and breaking the number down into tens and units:
X= ten
II= two
The two comes after the ten, and so we add two to ten, and get the number 12.
What about "IX"?
This time, we use rule number two:
X=ten
I= one.
The one comes before the ten, and so we subtract one from ten, and get the number 9.