1st Q&A
connecting !CPU and 2Monitors. The easiest way is to buy a video card that comes with 2 video output. This video card is very cheap now. With the video card, you can configure it to be a clone screen (means showing to identical in 2 monitor). It also can be configure to show extension of a wide screen display.
Since you only have 1 CPU, you only need 1 keyboard and mouse connected to the CPU.
2ndQ&A
connecting 2 CPUs and 1 Monitor. You have to buy a hardware call KVM Switch (Keyboard, Video, Mouse switch)
You have to use the keyboard to toggle between the 2 CPUs.
You only need 1 mouse and keyboard connected to the KVM Switch and 2 pairs of Keyboard and mouse extension cable to connect from KVM switch to the 2 CPUs.
Please refer to the url below for more info on KVM Switch
http://en.wikipedia.org/wiki/KVM_switch
http://www.aten.com/products/product_class.php