HUB: A hub is very "unintelligent". Every single signal/packet/bit/whatever that is placed on the network wire (cat5, coax, whatever), is blasted out every active port on the hub. In other words, every computer on a hub sees every computers data that is sent to the hub. In order for this to work correctly, every single computer/device connected to the hub must be running at the same speed and duplex. If 99 computers have a 10/100 Mbps network card, and 1 computer has a 10 Mbps network card, then all other 99 computers will renegotiate their speeds to 10 Mbps. This is because all of these computers are within the same "collision domain". This is so called because many times 2 or more computers will attempt to talk at the same time and this will cause the signals to collide. Each of these computers will detect that, wait for a random amount of time, and attempt to resend their data. This is absolutely normal. Just keep in mind that the more computers you stick on a collision domain, the more collisions you will have, and therefore the more retransmissions will have to occur, and therefore the slower things are going to get. The hub simply EXTENDS the collision domain so you can hook more devices into the same collision domain.
SWITCH: The switch is somewhat more intelligent than the hub. Every port on the switch is its own collision domain. So the fact that all your computers have to have the same speed and duplex, is only true as far as the switch port. In other words, you would take all your 10/100 Mbps users and your 10 Mbps only users, and stick them on 2 different ports of the switch. This would cause all the 10/100 users to work at 100 Mbps with no interference from the 10 Mbps people. Dont worry, the 100 Mbps people will still be able to talk to the 10 Mbps people just fine. BUT WAIT, THAT ISNT ALL! The switch is also smart enough that it actually reads the data from every PC, checks for errors, and then forwards it ONLY out the port that the destination computer is connected to, saving you the bandwidth on all other connections, whereas the hub simply sends it out all ports regardless of who is where. And because the switch checks for errors, it will discard the data if it is bad, thereby saving even more bandwidth. How does it do all this? When the data enters the switch, it looks up the destination MAC address. What is a MAC address? Every single network device/interface/computer in the whole world has its very own, and totally unique MAC address. This address is assigned by the manufacturer, and every single one in the whole world is different. When 2 computers send data to each other, they send the data to each other's MAC address. The switch listens to all these computers sending data, memorizes who is connected to which port, and then sends the data only out the port where the destination MAC address is connected to.
ROUTER: Ok, now things begin to get somewhat complicated. The switch may be fantastic, but it has one weakness. It only operates with the computers on the same LAN. It isnt smart enough to send data out to the internet, or across a WAN. In order to do that, you have to have a router. The router is the device which is smart enough to route data from the LAN to the internet, or to your ISP, or to your WAN, or even to another LAN. So in other words, you connect all the computers in your LAN together using a hub or a switch, then you connect 2 LANs together, or connect your LAN to the internet, using a router. One port on the router plugs into the switch/hub, and the other ports are used to plug into the internet or WAN link.
AND WHATS BEYOND THAT?: Well, there are devices which are switch/routers which are actually a very cool technology. The actually figured out how to make a router route packets with switching technology, making it a very fast and efficient router. Then there are devices even higher up and smarter than the router, but we wont get into that since they are very few and far between.
Well, I hope that answers your questions on what the difference between a router, switch and hub are.