The Racing Rules of sailing look immensely complicated. Too a large extent that's because they aim to cover every situation. You can read them on the ISAF Website.
However the good news is that its possible to put together a basic summary which covers the majority of situations. If you know and apply these and don't push your luck it will be enough for all but the very top of the fleet situations in keen club racing.
Avoid collisions and give other boats room to avoid solid objects like pontoons and the bank.
Port keeps clear of starboard.
Windward keeps clear of leeward.
The boat astern keeps clear of the boat ahead.
A boat tacking keeps clear of one that is not.
If you gain right of way or change course, give the other boat time to keep clear.
The inside boat(s) are entitled to room to round the mark.
A boat that is sailing backwards or not racing keeps clear of other boats.
If you have violated a rule, take a penalty .
Test your skills with Rules Quiz
This summary was written by Don Becker, a senior (sailing) judge for the US Sailing association. Many thanks for permission to reproduce it here.
Diagrams
In each of the diagrams the green boat has right of way over the red boat.
Rule 1
Avoid Collisions and solid objects!
Rule 2
Port (Red) keeps clear of starboard (green)
Two boats on opposite tacks, both going upwind.
Two boats on opposite tacks, running downwind.
Rule 3
Windward keeps clear of Leeward
Two boats on the same tack, both going upwind.
Two boats on the same tack, one running, one going upwind.
Rule 4
Boat astern (red) keeps clear of boat ahead (green).
Two boats on the same tack, one behind the other.
Rule 5
A boat that is tacking (red) keeps clear of one that is not (green).
One boat tacking. This means you cannot tack if you will be in someone's way whilst you are doing so.
Rule 7
The inside boat is entitled to room to go round the mark.
The boat on the outside (red) needs to give the boat on the inside enough room to get safely round the mark.