Actually there could be pages written about the unwritten rules of racing. As a race official for the Sports Car Club of America i'll try to boil it down to basic points, and these are somewhat my opinion but I believe they are accepted.
If a driver is under threat of overtake on a straight, they may alter their line to push the overtaking driver to the edge of the circuit but not off the circuit. The intent of this is to force the overtaking driver to have to travel a longer distance in order to complete the pass, and if they are still side by side going into the next turn, the overtaking driver will be compromised with a shallow entry allowing the overtaken driver to enter on a more normal racing line and attempt to use that to get back underneath and re-pass exiting the corner.
Now, if a pass is being attempted around the outside of the corner in pro racing, unless the overtaking driver is still very much alongside on the corner's exit, the overtaking driver must be aware that if he's too far back and out of the periphrial view of the other driver, the other driver is going to own the exit of the corner and will use up all the room, and the overtaking driver must either back off and try again or risk being run off the circuit. In club racing where budgets are smaller you'll sometimes see respect being paid and the driver on the inside will often leave enough room for the overtaking driver.
The main thing to remember is that you want to be sportingly defensive of your position, but there comes a point where you are either going to be passed or you will cause a crash. If so, best thing to do is go back to your normal line, and draft the car that just passed and look for a way back by.