I can't find any information about this myself, so I have to ask for help!

одна собака (one dog)
две собаки (two dogs)
три собаки (three dogs)
четыре собаки (four dogs)
пять собак (five dogs)


1) I don't understand why the ending is changing when it's five? Is it because "пять" ends with a consonant or a soft sign ?

2) What should I learn from this example?

3) What's this called in grammatical terminology? (So I can google it and read more...)

Grateful for help!