Finding component resistance

Resistors are used to limit current to LEDs (they drop voltage linearly dependent on current) or some other devices with similar properties, and to limit current into the gate of a FET which could otherwise briefly exceed the rated current for an output pin. They are used as pullups or pulldowns to keep a pin in a defined state when not connected to anything else, or for protocols that require them (like I2C), or to keep a MOSFET off. They can also be used as part of a filter or RC timing circuit, and have myriad uses when working with opamps. They can be used as a voltage divider to level shift a voltage lower (for example to measure the voltage at the input of a regulator, which would otherwise exceed Vcc and hence not be measurable with the arduino ADC - ex to measure the state of a battery). Very low value resistors can be used as a "shunt" to measure current. There are LOTS of uses for resistors.

A capacitor stores energy when different voltages are applied to the two sides of it; it can also be thought of as acting against any change in the voltage across the capacitor. Capacitors are used for filtering on the power rails (to help maintain a stable voltage in the face of sudden changes in load) - in this role they're mandatory for regulators to maintain a stable output voltage. Small ones (typically 0.1uF ceramic ones) are used for "decoupling" on power pins of digital ICs (the power consumption of these, even if low in absolute terms, can change so rapidly that the inductance of the wires to the IC results in a glitch that can cause undesired behavior - putting a decoupling cap right next to them will stabilize the voltage on the part during this time preventing that. Virtually every digital IC needs these, and 0.1uF is almost always appropriate). They are also used in filters, in RC timing circuits, as "loading capacitors" on crystals. There are LOTS of uses for capacitors too.

As to how to work out what you need, it all depends on what application you're using them for - as noted, there are a great many uses for both of them, some quite simple, and some very complicated.