this article tries to explain pretty much what you are asking, starting from basics:

http://tinyurl.com/aoknat

but take it with a large grain of salt

another view of camshafts from Jim McFarland:

http://www.hotrod.com/techarticles/113_9811_camshaft_tech_valve_timing_piston_movement/index.html

and David Vizard's controversial view:

http://www.popularhotrodding.com/tech/0607phr_camshaft_basics/index.html