Whilst at a crag in El Chorro I recently heard someone say that climbing is 80% confidence and 20% footwork. To be honest I think this is bang on the money. Without the head game you can technically be a good climber on an indoor wall but if you want to get out there into the mountains the head game is paramount.
Developing a strong head for climbing will rarely come over night. I remember being on routes in the early days as a complete gibbering wreck. Holding on for dear life, desperate not to test my gear and wishing I had never come up this stupid climb in the first place. The key is it does get better! The more time you spend on the rock the more confident you get in your abilities. You also learn how the line of a climb works, where the gear might be, what gear might be good and a plethora of useful things that help you to assess the safest way up a route.
There is no real fast track to a good head game. Some people may be born with an innate ability to block out their fears and cope with the rigours of dangling off cliffs with the possibility of decking out due to run out gear. However most of us have to build up this confidence bit by bit. A proper apprenticeship as a second is often the best way to go. Time on rock following other experienced climbers will allow you to appreciate the types of moves that you can do and the challenges that you can overcome. Once you realise that you can get up routes without falling you can start to become more confident in your ability to not end up as a bloodied splat on the floor! One thing I have done over time (although I wouldn’t recommend this) is to run out routes when on easy ground as well as adding the odd solo into the mix. This has helped me to test my fear and to push my boundaries.
Developing strength, fitness and improving technique can all help you to feel more confident. Whatever strategies you use the main key to your development will be the amount of time you spend leading on real rock. I have much development to do and lots to learn so all I can say is get out there and get climbing, I know I will be!