Taxis from the San Francisco airport, unless booked in advance, charge the "double-the-meter" rate. The only reasonably priced options are ride-sharing services such as Uber or Lyft, or the Supershuttle. The San Jose airport is similar except taxis normally charge the regular rate from there to Palo Alto.
The area around Stanford has many hotels with a wide range of prices. However, many hotels book unreasonably far in advance, so early reservations are strongly recommended.