In medieval texts and some early printed books, the numerals are written in lower case letters and u was frequently substituted for v. In the final position of the numeral, j could be used instead of i. So 18 could be written xuiij rather than XVIII. These substitutions are particularly found in italic fonts.
Sometimes the M and D were written using what I call above 'deep parentheses'. It is hard to show these using the fonts available on the computer but they were like a C and a mirror image or upside down C. Typesetters used the font the wrong way up to depict it. I will use normal parentheses to show them. In some examples the Roman numeral M is represented by a I in these deep parentheses thus ( I ). You can see how writing this quickly could lead you to write M. Similarly, D is sometimes represented by an I followed by a backwards C, thus I ). That seems to be used because it represents half of the M or 500. Again, written quickly it would become D.
This inscription, found in Rome, reads M D LXXXIII or 1583. The use of the deep parentheses  C and backwards C  is very clear. 
Here a typesetter has used the C font upside down to depict the date in a book. It has been amended by hand to read M D CCC XX III or 1823. Underneath it appears to read M D CC XC or 1790. 
The use of ( I ) for M or 1000 is derived from the way Romans depicted larger numbers explained below..
Forming numbers
At their simplest, numbers are formed by stringing the letters together to add up to the number required. Like this
The rule is to use the biggest numeral possible at each stage, so 15 is represented by XV not VVV nor XIIIII. It follows from this rule that numerals always go from left to right in descending order. This could still lead to some very long strings. For example, using this rule 99 would be LXXXXVIIII. So at some point a new rule was invented. A smaller value letter to the left of a larger value one is subtracted. So 4 becomes IV  which is 5 minus 1 
rather than IIII.
There are three rules about these smaller numerals which are placed to the left of a bigger one and subtracted.
This inscription for 1928 breaks one of the rules about subtractive numbers. 
These three rules limit the usefulness of the subtraction rule in reducing the length of Roman numerals. Although the year 2000 is quite neat at MM, 1999 is still quite long at MCMXCIX. MIM would be shorter but is not allowed by rule 2 above. See The 1999 Question for a discussion about why. The inscription for 1928, properly written, would be MCMXXVIII, which is longer than the form used.
The spreadsheet package Microsoft Excel has a function to depict numbers in Roman form. To get classical Roman numbers, conforming to the rules on these pages, use =ROMAN(n) where n is your number. There are four other versions of the function using progressively weirder versions of 'Roman' numbers. The fourth, ROMAN(n,4) giving what Microsoft calls the 'simplified' version. None of these four has any validity in terms of what real users of Roman numerals ever did and they seem to have been dreamed up by programmers in Gatesville. For live conversion of real numbers into genuine Roman numerals use ROMAN(xy) where xy is the reference to the cell containing the number you want to convert.
Excel will not display numbers in Roman format without converting them to text. But another software package, Fireworkz for Windows, will do so, allowing live working spreadsheets in Roman numerals! I used Fireworkz to generate the lists of Roman numerals on the adjoining pages. For more about the price and availability of this excellent and powerful software contact Gerald Fitton at Abacus Training.
The subtractive principle was familiar to the Romans as it was used in their calendar. Days were counted as so many before certain fixed points in the month. For example, the 9th of March was VII Id.
That means the seventh day before the Ides on the 15th day (note that the Romans counted the Ides as the first day, so the 9th is the seventh
day before NOT the sixth as you might expect). We also use a subtractive principle in
representing the time when we say 'quarter to eight' or five and 'twenty to nine'.
The strict rules about Roman numerals have been used only relatively recently. In earlier periods, although the subtractive principle was used, it was an alternative rather than compulsory and other forms such as VIIII for 9 and CCCCC for 500 were used. At any date exceptions can be found, as these four examples from different periods and all in Rome itself, show.
Only 33 doorways remain and they are numbered 23 to 54 with one unnumbered entrance. The numbers do not use the contraction IV or IX. Thus arch 29 is XXVIIII and arch 54 is LIIII. However, the contraction for 40  XL  is used and so door 44 is XLIIII, as the picture below shows.

ALEXANDER.VI.PONT.MAX 
This plaque is located on one of the four towers which Pope Alexander VI  who was pontiff from 14921503  ordered to be reconstructed. It is thought to be contemporary but may have been carved at a later restoration. Whatever date it is, it shows a complete disregard for the subtractive principle.
When drawing up 'correct' Roman numerals you must use the letters in the correct order and can use the subtractive principle as long as you stick to the three subtractive rules.
Larger numbers
Once a number gets bigger than a few thousand, Roman numerals become unwieldy. There are no
'bigger' symbols for 5000, 10,000 or a million. The Romans had two ways of
writing bigger numbers. They used what I call above 'deep parentheses' to
multiply a number by 1000. They were a C
and a mirror image or upside down C and I use normal parentheses to show them. Thus ( I )
is 1000 and ( X ) is 10,000. ( XXIII ) is
23,000. If you want to depict a million
you can use ( M ). Alternatively, the parentheses can be nested so
( I ) is 1,000 and ( ( I ) ) is 1,000,000.
The numbers can get a bit unwieldy as they get
bigger.
An alternative way of depicting larger numbers was to put a horizontal bar over the numeral, which multiplied it by 1000. Thus
_  _ 
V = 5000 and  X = 10,000. 
On a larger scale 3,852,429 can be depicted as
____________  
MMMDCCCL  MMCDXXIX 
However, in some cases a sentence containing words and numbers would use a horizontal bar to show simply the letters which were being used as numbers. In other cases that was indicated by a small sign looking like two parentheses () placed above the numbers.
To depict even larger numbers sidebars could be added to the line,
multiplying the total by a further 100 so the enclosed numeral was to be
multiplied by 100,000. Thus
___
XII meant 12,000 but
____
 XII  meant 1,200,000. When written in wax on a tablet these sidebars could
look like a curved line, and create an ambiguity about the number. Was it a
curve straight line or a line with short sidebars? Such a dispute is said to
have occurred when the Roman Emperor Tiberius inherited his mother Livia's
estate. She had written out the legacies he should pay to various people and one
to Sulpicius Galba was written as
________
 CCCCC  or 50,000,000 sesterces. But the sidebars were short and curved and
Tiberius insisted they were simply a curved line and the true legacy was
_______
CCCCC or 500,000 sesterces. As Tiberius was Emperor, poor Galba only got one
hundredth of the legacy Livia had intended. A sestertius was enough to buy two
loaves of bread, so the modern equivalent is around £1.50 or $2.50, perhaps a little
more.
The original source for this story is Suetonius Tranquillus The Lives of the Twelve Caesars which says of Galba
"He showed marked respect to Livia Augusta, to whose favour he owed great influence during her lifetime and by whose last will he almost became a rich man; for he had the largest bequest among her legatees, one of fifty million sesterces. But because the sum was designated in figures and not written out in words, Tiberius, who was her heir, reduced the bequest to five hundred thousand, and Galba never received even that amount." (Suetonius, Galba 5, translated Loeb Classical Library 1914)
The details about the sidebars were added in Georges Ifrah, The Universal History of Numbers, Harvill Press, London 1998, p200. He wrongly cites Seneca (Galba, 5) as his source.
Fractions
The letter S was used to depict a half. Other fractions were shown by dashes,
each dash being worth one twelfth. So  meant 1/12, = meant two twelfths which
is one sixth, and so on.
  1/12 
=  2/12 or 1/6 
 =  3/12ths or 1/4 
= =  4/12ths or 1/3 
 = =  5/12ths 
S  1/2 
S   1/2 plus 1/12th or 7/12ths 
S =  1/2 plus 2/12ths or 2/3 
S  =  1/2 plus 3/12ths or 3/4 
S = =  1/2 plus 4/12ths or 5/6 
S  = =  1/2 plus 5/12ths or 11/12ths 
So twenty three and a half would be written XXIIIS and twelve and a quarter is XII=. The letter S and the dashes were never used subtractively. Other fractions could not be depicted in Roman numerals.
Zero
The Roman numeral system did not include zero and Romans had no concept of it
in their arithmetic. Which is one reason why Roman numerals are so clumsy for calculation,
though it is possible. They tended to use an abacus for arithmetic and that
device does have the concept of zero built in  it is represented by an empty row. But it was the
Indian and Arab mathematicians after the end of the Roman empire who invented
our present system where we have the concept of 'place' and have a distinct
symbol to represent zero or an empty column. So when we write '10' for example the zero tells
us that the '1' is worth ten times as much as it would be if the number was just
1. The value of this system for arithmetic and calculation and for depicting
numbers of any size is so great that the IndoArabic way of writing numbers is
now almost universal and Roman numerals are confined exclusively as 'counting'
numbers rather than as calculating numbers.
Brief
history of Roman numerals
Modern uses of Roman numerals