Why did Itachi poke Sasuke's forehead? From the beginning of the series, even during his last moments, Itachi poked Sasuke's forehead as a way of showing affection and apologizing.

But is that the only reason? Did he perhaps try to transfer some knowledge or memories to Sasuke? Or is it simply unknown?
It has nothing to do with transferring memory or knowledge.

It's a gesture of love from Big Brother (Itachi) to his loving Younger Brother (Sasuke). 
That gesture show how much Itachi love Sasuke than anything.