Excerpts of a memoir written by the late Russian opposition leader Alexei Navalny have revealed he believed he would die in prison.