Intro: What is Synergy?

Synergy is a free and open source software that allows multiple computers to share a mouse and keyboard. One of the computers that the keyboard and mouse is connected to becomes a Synergy server. The other computers becomes Synergy clients. All of this is done over the network. So if your Raspberry Pi is connected to the network somehow (via Ethernet or WiFi), you can setup your Raspberry Pi as a Synergy client so you can remotely control your Raspberry Pi from another computer.
Other ways of remote controlling the Raspberry Pi are VNC and SSH. VNC requires transmitting large amounts of data because it involves transmitting screen images, thus it is slower than Synergy over a slow network. SSH is great for command line work but not for a GUI environment. Synergy requires very little data but it does mean that the Raspberry Pi needs to be connected to a computer monitor.

You can also use the Raspberry Pi as a Synergy server, but this is not recommended. One reason is that Synergy isn't perfect, certain keys or special keys do not work. Some keyboards and mice have special functions that require special drivers, which Synergy and Linux might have trouble supporting.

Although a version of Synergy compiled for ARM (Raspberry Pi uses ARMv6) is available through Raspbian's package manager, it is not the latest version of Synergy. Existing users of Synergy may have updated their server installation. The protocol changes between different versions of Synergy means that you must run the same version of the client and server. Thus, we must recompile Synergy from the source code on the Raspberry Pi.

Setting up a Synergy Server

You should first install Synergy on your main computer. Simply download it from Synergy's website, select the one appropriate for your operating system. Install it as normal. Check out Synergy's help page.

Before starting the server, configure the server to accept connections from a computer named "pi". Configure the hot-corners or hot-keys as you desire.

If you get a server/client verison mismatch, make sure you're running 1.4.15. If you're using Ubuntru, try this package, which is able to sucessfully install synergy 1.4.15 on ubuntu 14.04.2:
https://launchpad.net/~eugenesan/+archive/ubuntu/ppa/+build/5381426

The command I used to install the package was:
sudo dpkg -i synergy_1.4.15-0-eugenesan-lucid1_i386.deb

At first attempt, it didn`t work because of some dependency problems. To solve that, I did two things:
1 - Ran this commands:
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade

2 - Installed libcryto++8 manually, downloading it from http://packages.ubuntu.com/lucid/i386/libcrypto++8/download

(thx andre!)

Compiling Synergy for Raspbian

Although you can get Synergy through the package manager, it is an older version that may be incompatible with newer Synergy server versions. We are forced to compile Synergy ourselves to ensure that it is using the latest protocol and runs on Raspberry Pi's ARMv6 processor.
Download the source code tarball from Synergy's download page, it must be the .tar.gz file. Save it to /home/pi/downloads (make sure that folder exists first)
Alternatively, use wget through the terminal
cd /home/pi/downloads
sudo wget http://synergy.googlecode.com/files/synergy-1.4.15-Source.tar.gz
Extract the tarball
sudo tar -xzf synergy-1.4.15-Source.tar.gz
Raspbian does not come with some of the tools you might need, use the APT package manager to install the required tools. The following command will take some time and eat up some disk space.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install gcc cmake libx11-dev libxtst-dev
Navigate into the source code directory
cd synergy-1.4.15-Source
Right now, what you should be doing is running cmake, which should generate a makefile. But at this point, cmake will fail with an error regarding not being able to find some header files. An error like "Missing header: X11/Xlib.hX11/XKBlib.h" might show up. This is because Synergy's CMakeList.txt file is looking for header files inside /usr/local/include , but in Raspbian, it should be looking inside /usr/include. We'll fix that by editing CMakeList.txt.
sudo nano CMakeLists.txt
Use the nano text editor to look for the line
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
and change it to
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/include")
and close nano, the hot-key for closing nano should be CTRL-X

It will ask you to save before closing, you must save it
Inside the directory synergy-1.4.15-Source/tools , there is a zip file called cryptopp562.zip containing the Crypto++ library, which you must extract into the directory synergy-1.4.15-Source/tools/cryptopp562 , if you don't do this, you will eventually run into an error looking for the files inside. Do this from the terminal
sudo unzip ./tools/cryptopp562.zip -d ./tools/cryptopp562
There's a bit of strangeness inside the synergy-1.4.15-Source/tools/CMakeList.txt file, it wants the C compiler to compile for the native architecture, but this will cause an error when the compiler doesn't understand what the word native means. We need to change this to ARMv6 since we are on a Raspberry Pi. Open the file using nano
sudo nano ./tools/CMakeLists.txt
Look for the line
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")

and edit it to the following on a Pi 1

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv6zk")

for the Pi 2, do this instead:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a")
and close nano, the hot-key for closing nano should be CTRL-X

It will ask you to save before closing, you must save it
We have now done all of the steps to preemptively prevent the errors you will face.

Now we can use cmake to configure our makefile build
sudo cmake .
This will take a while... grab a coffee. After it finishes, it should say:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/download/synergy-1.4.15-Source
What it did was check over your system to see if you have all of the required files, and see what kind of tools are available. It uses this information to generate a makefile for you.

Now you can use make to build the source code according to the makefile
sudo make
This time, nuke some popcorn and watch a movie, this literally took a few hours. Nobody claimed that the 700MHz Raspberry Pi was very fast.

When it finishes with no errors, a new directory at synergy-1.4.15-Source/bin should exist, and inside should be several executables files. Install these by using the copy command to copy the files into the /usr/bin directory
sudo cp -a ./bin/. /usr/bin

Setup Synergy Client Autostart

Now you've compiled and installed Synergy for the Raspberry Pi, you probably want it to start right away whenever you start the LXDE.

You need to create an autostart file for LXDE, or add to it if it already exists, do the following through the terminal
sudo mkdir -p ~/.config/lxsession/LXDE
sudo touch ~/.config/lxsession/LXDE/autostart
sudo nano ~/.config/lxsession/LXDE/autostart
This will open the autostart file, add the following line to the bottom of the file
~/.startsynergy.sh
What this does is start the script named .startsynergy.sh whenever LXDE starts

We need to write the .startsynergy.sh script, again, open the file using nano
sudo nano ~/.startsynergy.sh
The script contents should be
#!/bin/bash

killall synergyc
sleep 1
synergyc --name pi 192.168.0.16
exit 0
Change the IP above to whatever your Synergy server's IP is!
Close nano, the hot-key for closing nano should be CTRL-X

It will ask you to save before closing, you must save it
Now we need to make sure the script has permission to execute, use the chmod command
sudo chmod 777 ~/.startsynergy.sh
and you are pretty much done, make sure the Synergy server is running, and reboot the Raspberry Pi. When LXDE starts again, the Raspberry Pi becomes a Synergy client and connect with the Synergy server automatically.