I understand the first sentence you wrote for the need of a different summation index. However, i'm still not able to understand the individual steps. Like how in the first line we have four partial derivatives: 1st one is dpj/dqi second is df/dpi third is dpj/dpi and fourth is df/dqi. If you could explain how each of those partial derivatives have been simplified to get to the second line in which we have two terms one is of delta and second of df/dpi. Then from there how have they got to the third and last line so how did they simplify delta term and then df/ dp term to get -df/dq where summation is over j now and df/dp has become df/q?
Any help would be much appreciated.
The reason for computing $\{p_j,f\}$ instead of $\{p_i,f\}$ is that $i$ is used as the summation index. You can of course compute $\{p_i,f\}$ if you like, but then you have to rename the summation index instead.
The notation $\delta^i_j$ is the Kronecker delta symbol, which equals one if $i=j$ and zero otherwise. In many contexts it is written as $\delta_{ij}$, but here the positions of the indices are used for indicating that it's a tensor of type $(1,1)$. (If you don't know what that means, you can just ignore it for now.)
(By the way, they aren't being very consistent regarding the index placement on the $p$ variables...)
And the reason that $\partial q_j/\partial p_i = 0$ and $\partial p_j/\partial p_i = \delta^i_j$ is very simple: when you compute the partial derivative with respect to $p_i$, you are holding all the variables $(q_1,\dots,q_n,p_1,\dots,p_n)$ constant, except for $p_i$. And the derivative of a constant is of course zero. But $\partial p_j/\partial p_j=1$.
It's just like the following situation: if the variables are called $(x,y,z,w,\dots)$, then $\partial x/\partial x=\partial y/\partial y=\dots=1$ and $\partial x/\partial y=\partial x/\partial z=\dots=\partial y/\partial x=\dots=0$.
Answers to edited question:
But I see now why you are confused! There is a typo in the text, that I didn't notice before: the $p$ in the second-to-last line should of course be a $q$. Whoever wrote that seems to have been a bit sloppy (considering also the inconsistent placement of indices on the $p$ variables)...