The channel graph
Public channels are announced over a gossip network: the funding output, the two node keys, and each side's fee policy and limits. Every routing node keeps this graph. Private channels (most mobile wallets') are not announced; the receiver includes a route hint in the invoice so senders can reach them through their peer.
Source routing
Unlike the internet, the sender chooses the whole path. From the graph it finds a route to the destination that satisfies the amount, minimising fees and timeouts. Only the sender knows the full route.
Sphinx onion
The sender encrypts the route in layers, one per hop, like an onion. Each node peels its layer with its own key and learns only: where the payment came from, where to send it next, and the amount and timeout to forward. It cannot tell whether the previous node was the sender or a relay, or how many hops remain. The packet is a fixed size so its position in the route cannot be inferred.
Why payments fail
The graph shows channel capacity but not how it is split between the two sides. A route may look fine and fail because a channel lacks balance in the needed direction. The sender receives an error, updates its view, and tries another route, usually within a second. Large payments fail more; multipath payments split them into parts sent over several routes, which succeed or fail together.
Fees and policy
Each hop charges a base fee (often around 1 sat) plus a proportional fee (often tens of parts per million). Routing nodes set these to balance their channels. Fees are usually tiny; what the sender pays for most is reliability.