How to choose the size of the IV in AES-GCM?
But how to choose the IV's size and how - if so - it affects the
  security of the algorithm?


You really want to give 96-bit IVs to GCM (pad them if neccessary).

If you pick any IV size but 96-bit, GCM's polynomial hashing function GHASH is invoked to get the IV size down to 128-bit. This means that you basically apply a PRF on your IV, which means that there's a decent chance of hitting a collision if you use about $2^{64}$ IVs which will allow for a key-recovery attack on GCM and allows you to forge ciphertexts (numbers corrected by poncho).

NIST SP800-38D (PDF) has further treatment on the security considerations (especially with regards to IV sizes) in section 8. Furthermore it is the specific recommendation of NIST to use a 96-bit IV (section 5.2.1.1, found by Maarten):


  For IVs, it is recommended that implementation restrict support to the
  length  of 96 bits, to promote interoperability, efficiency, and
  simplicity of design.