When a packet arrives, the router follows a specific process to forward it:
Extract the destination IP address from the packet header
Search the routing table for matching entries
If multiple matches exist, select the most specific (longest prefix)
If no match exists, use the default route (if configured)
If still no match, drop the packet and send ICMP "destination unreachable"
This process happens for every packet. Modern routers use specialized hardware (ASICs) to perform millions of lookups per second. The lookup result determines both the outgoing interface and the next-hop address.