First I want to say that this is a real nice question.
I totally agree with the previous answers, it can be 1.possessive, 2.that or emphasis.
for 3rd, I would say that if you take away ki the meaning does not change much.
example;
Neden gitmedi ki anlamadım. = I did not understand why he did not go.
when we add ki here it sounds like we wonder a little bit more than average in this sentence :-
another example;
O zaten söyledi ki! = He already said! here it just put some more emphasis on the word 'already'.
for 2nd, we do not use it like the "that" in English always, indeed we can, but it is just not that common. for example;
He said that he will go.
O gideceğini söyledi. is the form we use most.
maybe one would say O dedi ki yarın gidecekmiş.
(not to make you confused, demek : to say, söylemek : to tell)
and for the first one;
masadaki kitap : the book (which/that is) on the table
filmdeki adam : the man (who/that is) in the movie
if someone ask which book? then the answer is masadaki
and the answer to which man? is filmdeki likewise.
and also we can use it to skip nouns (like mine in English)
benim kitabımı kullan --> use my book
benimkini kullan --> use mine
benimki = mine, seninki = yours, onunki, bizimki, sizinki, onlarınki
and people usually say benimki or seninki referring to their partners in colloqual language.
I hope this answer will help you. If there is something you want me to explain, please feel free to ask. Good luck!