Hello there,
maybe the following link can help you:
http://www.st-andrews.ac.uk/media/24-25%20How%20to%20Apply.pdfBasically, all applications to universities in the United Kingdom are made through a centralised organisation called UCAS. The normal deadline to apply is 15th January for entry in September. If you're late, there is a process called "clearing" which offers places if not all spots a university has to offer are filled yet - although for St Andrews in particular that is unlikely to work out, as the demand is generally higher than the available places.
The website of UCAS:
http://www.ucas.ac.uk/The application forms can be a little confusing and takes some time to complete, as you need to write some sort of statement ("lettre de motivation") and get someone to write you a reference.
I hope that helps. Feel free to contact me or reply here if you have more questions.