I think you also have to take into account the 'lone pairs' of valence electrons when considering the structure, as well as the total number of atoms bonded to the 'central' atom. Having electrons too close to each other causes unnecessary repulsion, as negative charges repel. Off the top of my head, the rules you have quoted appear to be for atoms where the number of bonded atoms + number of lone pairs is 4. For example, the O atom in H2O would have two bonded atoms and two lone pairs, so the diagram you would draw would be V-shaped. Likewise, the C in CH4 would have four bonded atoms and no lone pairs, so the diagram you would draw should indicate tetrahedral geometry. However, in CO2, note that the C is bonded to two atoms, but has no lone pairs remaining. The best way to minimise electron-electron repulsion in this model would therefore be to have the two O atoms as far away from each other as possible, which is why the resultant structure is linear.
My approach to learning these was to first realise that (at VCE level), the key determinant of structure is the combined number of atoms bonded to the central atom, and central atom lone pairs. From there, I considered the 'parent' geometries of this combined number. For example, the parent geometry when the number of bonded atoms + lone pairs = 4, is tetrahedral. Now, should there be 3 bonded atoms and 1 lone pair, then the lone pair would take up one position on the tetrahedron, so if we only look at the central atom and 3 bonded atoms, then we get something that looks trigonal pyramidal. Likewise, should there be 2 bonded atoms and 2 lone pairs, each lone pair takes up a position on the tetrahedron, but if we just look at the central atom and 2 bonded atoms, we get the 'bent' structure.