This is the 1362nd most frequent Russian word.
испании
The word "испании" is the genitive or locative case of "Испания," meaning "of Spain" or "in Spain" in English.
In this sentence, 'Испанию' is the accusative case of the word 'Испания' (Spain). It reflects the direct object of the verb 'посетить' (to visit). In this sentence, Испания is a proper noun referring to the country Spain.
Я хочу посетить Испанию в следующем году.
I want to visit Spain next year.
Here, 'Испании' is the genitive case of 'Испания'. It is used to indicate possession related to 'историю' (history), meaning 'the history of Spain'.
Мы изучаем историю Испании.
We are studying the history of Spain.
In this case, 'Испании' uses the prepositional case of 'Испания' to denote location. The equivalent English preposition 'in' governs its usage, established by 'в' (in).