connecting IC with external components
The Diodes are the Mosfet body diodes. They are internal, and part of how the mosfet works. The Mosfet themselves are used as simple level shifters on the I²C clock (SCL) and data lines (SDA) enable I²C communication with microcontrollers operating at the same voltage as VIN (2.5–5.5V)
i2c, an open drain protocol, requires pull-up resistors. The value of the resistors are defined based on bus capacitance, length, i2c frequency, desired rise/fall times, etc. Or more simply, standard values are chosen. 4.7kΩ works just as well as 10kΩ, for general usage.
Which components? The Caps or Resistors? Generally, the datasheets for the ICs that are being used will dictate what they need, and have general guidelines or reference designs in them. And often formulas for certain variables. Notice Section 4 of the Compass datasheet, keyword nominally. The chosen capacitors should be around those values, don't need to be exact (and most ceramic caps have a high +- tolerance rate). The schematic section 4 as well, is essentially what the Pololu board copies, except for the mosfet level shifter.


  The C1 and C2 external capacitors should be low SR value ceramic type constructions (typ. suggested value 200 mOhm). Reservoir capacitor C1 is nominally 4.7 μF in capacitance, with the set/reset capacitor C2 nominally 0.22 μF in capacitance.
  The device core is supplied through the Vdd line. Power supply decoupling capacitors (C4=100 nF ceramic, C3=10 μF Al) should be placed as near as possible to the supply pin of the device (common design practice).

That question is very open ended. A general electronics textbook would help. I personally learned by reading datasheets.