Everyone may, or may not remember the old paper Smashing the Stack for Fun and Profit. While I recommend you learn this old methods to get a basic understanding of what is going on, security has come a long way and most of those tricks will not work anymore. This paper takes a look at buffer overflows from a modern perspective:
http://www.exploit-db.com/papers/24085/