You also get bonus spells based off of your main stat. So for example, if your Cleric has a 16 Wisdom at 1st level, you will get to cast 3 Zero level spells (you know all of them, but you can only pick 3), 1 normal spell (see zero level spells), 1 domain spell (limited to whatever domains you picked, you get to choose one), and a Bonus spell because you have at least a +1 wisdom modifier. Thus giving you 2 first level spells to chose from, a Domain spell, and 3 zero level spells at First level. It progresses up, so at 2nd level you get 4 zero level spells, 2 first level spells, 1 domain spell, and 1 bonus first level spell. At 3rd level you have 4 zero, 2 first, 1 first level domain spell, one bonus first level spell, then 1 second level spell, 1 second level domain spell, and that's due to that 16 wisdom (the +3), you gain a bonus 2nd level spell.
That 16 Wisdom will give you bonus spells up to the level of the bonus, so +3 equals bonus spells level 1 through 3. As you increase that Wisdom every 4 levels and even with magic, the bonus spells increase as do the save DC. A high stat is also a requirement for the maximum level of spell you can cast. For example, a Cleric with a 12 wisdom can only cast 2nd level spells and the save DC is only +1. This character can add +1 to their wisdom every 4 levels, and thus at 20th level be able to cast 7th level spells. Also their save DC will not be difficult to over-come. This is why any caster who has a list going to 9th level will want to start out with at least a 16 in their core stat (Cleric-Druid/Wis, Wiz/Int, Sorc/Chr). The shortened casters like a Bard only really needs a minimum 16 and Paladins and Rangers will want at least a 14.
But if you want to cast a lot of 'save or die' spells or spells like illusions and enchantments that are saving throw based, you will want to start out with the highest stat you can, and then keep pumping it.
A house rule me and my friends use is rolling up the bonus spells. So for example, that 16 Wisdom Cleric at first level has access to 3 bonus spells, but can only use 1. Well we will allow a caster to have access to all 3 bonus spells as first level spells. Then at 3rd level when they get a 2nd level spell, they will get 2 bonus first level spells and 1 second level spell. Then at 5th they will get one bonus spell at first through third. So far it has not been game breaking and allows the casters a little more stamina before they have to rest.