A switch is a network device that operates at the, so called, "layer 2" (L2) also known as "Data link layer" in the OSI model and "Link layer" in the TCP/IP model. The most used layer 2 protocol today is Ethernet (IEEE 802.3).
On the other side a router is a network device that operates at "layer 3" (L3) known as "Network layer" in the OSI model and "IP layer" in the TCP/IP.
The most important difference between them is that a switch bases its forwarding decision on a layer 2 address (in ethernet is called MAC address) whereas a router on the layer 3 address (the IP address). So basically switches care about MAC addresses and routers about IP addresses.
To find the answer to the rest of the question please refer to this Su Question: What is the difference between a VLAN and a subnet?