On one hand, it's easy to say that "ni" and "ń" is the same sound. But they are a bit different.
As in 'ni' you have 'i', it is pronounced in a way. It's a bit like "ńi".
"ni" is written before vowels, "ń" before consonants and at the end of the word - at least the word in Nominative.
As actually "koń" is Nominative singular, but "koni" is Genitive plural. Too early to discuss Genitive, I guess ;)