Wake on LAN (WOL) is a platform independent networking standard which allows to "Wake-Up" (resume from shut down / hibernate / sleep) a computer remotely by a specifically crafted network message called magic packet.
In order to use this protocol first of all you must have compatible hardware. This includes motherboard, BIOS and network card.
You should use Ethernet network connection as WOL in most cases will not work over wireless (there are exceptions). As an alternative to wireless you can use one of many available HomePlug devices. WOL works fine over HomePlug.
First of all boot into BIOS (when computer boots press F2, DELETE, or other depending on your motherboard model) and enable WOL support. Normally it's under "Power Management" section and can be called Wake-on-LAN, Remote Wake-up, or something similar. Most of the modern computers will have this option, however if you have very old hardware you may be out of luck.
Also check for power saving modes in BIOS. Some of them may be not compatible with WOL. There should be explanations next to each mode. Or you can just disable all of them to start with.
If your motherboard and BIOS are compatible with WOL, integrated network card will be compatible too. However if you use an external or PCI network card, check card's compatibility as well. Some PCI cards need to be additionally connected via a special WOL cable to the motherboard, or be plugged in into a specific PCI port.
Configure router / firewall
If you only intend to use WOL on your local LAN network you can skip this part. However, the most useful WOL feature is ability to wake up remote computer over the Internet.
First of all if you are on residential broadband, your ISP most likely have issues you with a dynamic IP address. This means your WAN regularly
To make this work you need to forward all WOL magic packets coming from the Internet to your LAN network. In theory any UDP port can be used for WOL, but normally UDP ports 9 and 7 are used.
This can work in a similar way as a standard port forwarding on a router. Difference is that when computer is switched-off it doesn't have any IP address, therefore you need to forward WOL packets to all devices (MAC addresses) on the network. This is normally done by forwarding UDP port 9 or 7 to a broadcast address.
Broadcast address is the last IP address on your local network. In standard home network setups with 255.255.255.0 subnet mask it will normally end in 255. If your computer's IP address is 192.168.0.x your broadcast address will most likely be 192.168.0.255. Simply forward incoming traffic on UDP port 9 to your broadcast IP address (192.168.0.255 or other) and you should be fine.
It's impossible to give exact instructions as web interface for different routers can look completely different. If you unsure check your router's manual or search online for your router's model + port forwarding.
Unfortunately port forwarding to broadcast address may not work on some routers, especially cheaper ones. In this case you can try forwarding WOL packets to your computer's normal IP address, but make sure you setup a static IP reservation for your PC's MAC on the router. Problem with this approach is that you often end up in situation when WOL works only for few minutes after you shutdown your PC. This is because of ARP cache and how works on most routers. ARP links device IP address to its MAC address. Routers periodically purge ARP cache removing devices which are no longer on the network. When computer entry is removed from ARP cache, port forwarding to IP address is no longer possible. On some routers setting static IP reservation makes ARP cache to keep that particular IP-MAC entry indefinitely, so it’s worth trying. One more option is to manually enter a static ARP record into the ARP cache. Some, more advanced routers allow to do this either via a web-gui or via SSH/Telnet.
If everything fails you may need to find another, more advanced router. It’s also worth checking if your router is supported by DD-WRT. If it is, you can replace your router’s firmware with DD-WRT which will supports WOL and many other advanced features.
Send "Magic Packet"
Once hardware is configured, make sure you know your network card's MAC address. In Windows you can find it by running ipconfig /all in a command prompt.
If you want to wake up a computer on the same LAN network you need to to send a magic packet to your network's broadcast address from any other device on the same network.
You can download a free magic packet sender from for Windows desktop from here and for Android smartphones/tablets from here.
If you need to wake up your computer over the Internet, you can either use the same WOL utility, or an online magic packet sender (one is available below). You will need specify your network card's MAC address and your router's external IP address. If your ISP assigns you a dynamic IP address (this is the case with majority of residential broadband providers) you can use NO-IP or another similar Dynamic DNS service to keep your changing IP address associated with a static DNS address. Many routers have a built in Dynamic DNS support.