How can I control two computers with the same keyboard and mouse?
There is this open-source software hosted on Sourceforge.net:
Synergy
Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It's intended for users with multiple computers on their desk since each system uses its own monitor(s).
Redirecting the mouse and keyboard is as simple as moving the mouse off the edge of your screen. Synergy also merges the clipboards of all the systems into one, allowing cut-and-paste between systems. Furthermore, it synchronizes screen savers so they all start and stop together and, if screen locking is enabled, only one screen requires a password to unlock them all.
Another free software (only for Windows):
Input Director
Input Director is a Windows application that lets you control multiple Windows systems using the keyboard/mouse attached to one computer. It is designed for folks who have two (or more) computers set up at home and find themselves regularly sliding from one system to the other (and wearing out the carpet in the process!).
With Input Director, you can share a single keyboard/mouse across a set of systems. You switch which system receives the input either by hotkey or by moving the cursor so that it transitions from one screen to the other (in a very similar fashion to a multi-monitor setup). The idea being that you can position the monitors from two or more systems in a row and use a shared keyboard/mouse to control all of them. Input Director also supports a "shared" clipboard, in which you can copy data onto the clipboard on one system, transition across to another and paste.
Input Director requires Windows 2000 (Service Pack 4), Windows XP (Service Pack 2), Windows 2003, Windows Vista, Windows 2008 or Windows 7. The systems must be networked.
See this blog post which explains some differences between the two programs.
There is a hardware solution as well, so called KVM (keyboard, video, mouse) switches:
A KVM switch is a hardware device that allows a user to control multiple computers from a single keyboard, video monitor and mouse. Although multiple computers are connected to the KVM, typically a smaller number of computers can be controlled at any given time.
You could use a KVM (Keyboard/Video/Mouse) switch, though you won't need the "V" part.
Poor man's solution: Use a USB hub and plug your keyboard and mouse into that. Then run a USB cable from each computer up to the hub and plug in the cable for the computer you want to control.