How does tor find the nodes? In other words, how does tor know which ip addresses are tor nodes and which aren't?
The IPs and public keys of 9 directory authorities is compiled into Tor. Tor can download an initial list of all relays (the consensus) from those directory authorities.
How do clients know what the relays are, and how do they know that they have the right keys for them?
[...] The directory authorities provide a signed list of all the known relays, [...] specifying their keys, locations, exit policies, and so on.
How do clients know what the directory authorities are?
The Tor software comes with a built-in list of location and public key for each directory authority.