Routing is the process during which data packets are forwarded from one machine or device (technically referred to as a node) to another on a network until they reach their destinations.
Routing is the same as switching (with some very technical differences, which I will spare you from). IP routing uses IP addresses to forward IP packets from their sources to their destinations. IP adopts packet switching.
How Routing Works
Let us consider a scenario where Li sends a message from his computer in China sends a message to Jo's machine in New York. TCP and other protocols do their work with the data on Li's machine; then it is sent to the IP protocol's module, where the data packets are bundled into IP packets and sent over the network (Internet).
These data packets have to cross through a lot of routers to reach their destination half the world away. The work these routers do is called routing. Each packet carries the IP addresses of the source and destination machine.
Each of the intermediate routers consult the IP address of each packet received. Based on this, each will know exactly in which direction to forward the packet. Normally, each router has a routing table, where data about the neighboring routers is stored. This data is used to calculate and decide where to send the packets.
The packets go each one its own way, and can move through different networks and take different paths. They all finally get routed to one same destination machine.
On reaching Jo's machine, the destination address and the machine address will match. The packets will be consumed by the machine, where the IP module on it will reassemble them and send the resulting data above to the TCP service for further processing. This picture briefly depicts IP Routing.