There is grammar named in Russian as "падежи". There are 6 form of padeji. We use padeji depending of situation. For example, я иду в магазин (в магазин - винительный падеж) -I go to a shop. Here you say about moving direction and say about terminal. Other example, я иду из школы (из школы - родительный падеж). Here you say about moving direction and show starting place.
So, practically all Russian words have padeji. ( with the exception of verbs, adverb and etc). The word "Я" also have padeji.
Именительный падеж - я (кто, что)
Родительный падеж -меня (кого, чего)
Дательный падеж - мне (кому, чему)
Винительный падеж - меня (кого, что)
Творительный падеж - мной (кем, чем)
Предложный падеж - о мне (о ком, о чем)
Each padeji has some questions thank to you can understand what form you should use.
For example, Родители говорили о мне (Parents talked about me). You can ask - родители говорили о ком? О ком - предложный падеж.
Other example. Мне дали книгу ( I got a book). You can ask - кому дали книгу? Кому - дательный падеж.
Of course, it is very difficult theme. It seems for me, due to padeji the Russian language is named the most difficult language in the world.
I hope I help you a little.
Good luck! :)