You can take your theory test as soon as you reach your 17th birthday and I'd strongly advise you to take it as soon as you can.
You will need your Provisional Licence before you can book your test.
You'll also need to take this with you when you attend for the test.
The test is in 2 parts. You'll answer 50 multi-choice questions and you'll complete a video based hazard perception test comprising of 14 video clips
You must score 43 out of 50 to pass the multi-choice section.
You must score at least 44 points out of a possible 75 to pass the hazard perception test.
Don't forget once you've passed that the certificate only lasts for two years. If you don't pass your driving test in that time you'll have to sit the theory test all over again.
There's no reason at all not to pass your Theory Test at the first attempt, although nerves do often play a part. The best advice I can offer for the multiple choice questions is to take your time and re-read your answers. It's so easy to make a mistake and to think you've answered a certain way, then when you check you realise you've ticked the wrong box. It happens to us all so take your time, check and double check when you can.
For your reference I've included a link to the official DVSA video on the Theory Test below.