A Hub is a Concentrator and acts as a wiring splitter. It is a common wiring point for a star network (as is a switch). It centralizes your wiring. It can also be used as a repeater, if it is powered. It takes a all signals it receives on one port and distribute them out through all ports.
A Switch is similar, except that what it does is create a Virtual Path from one port to another based on the MAC address of the 2 devices connected to each port. It maintains a memory map of each Port/MAC address and will only send the data it receives from port to the port that the destination device is connected to (unlike the Hub, which broadcasts each Packet to all the ports). This greatly decreases the traffic on the network as the data only goes to device and not all of them.
A Router is a device that sits between 2 or more networks and routes the data based on their layer 3 address (IP address if IP - switches are a layer 2 device that uses the MAC address).
Where you use the devices depends on your needs. You can pretty much use a Hub and Switch interchangeably. The main difference is the amount of traffic generated. For a small network (5 computers), you shouldn't notice a difference, unless you do a lot of large file transfers. For the price on a small, you may as well use a switch as they are fairly inexpensive now unless you need the features of high end switch (Vlan, for example). Hubs and switches are mainly used on the same network segment (except for the afore mentioned VLAN used in the upper level switches).
If you have a large number of computers (100 for example), you may want to segment your network to decrease the traffic and limit collission problems. The problem here is that a computer on segment A cannot talk to a computer on segment B. For this, you need a router to talk between segments. On your home system using broadband, you can use a router to set up a local network (recommended), but to talk to the internet you need a router (such as Linksys or Dlink) to "Route" your packets to and from the Internet as it is now on another "segment".