In PEKS, it is important to understand the basic knowledge of bi-linear pairing computation and its principles, so maybe firstly you can take a quick look at the relevant knowledge of public encryption schemes. Hopefully, it is of use for you.
a_i is not part of the algorithm, it's part of the security proof. It's a random number between 0 and p-1 which is used as an exponent for g. h_i *might* be a hash or it *might* be g^a_i, depending on other factors in the algorithm. The security proof shows that if you can break PEKS, you can solve the Bilinear Diffie-Hellman problem (BDH), which involves powers of g. h_i and a_i become part of the BDH calculations. As the previous poster mentioned, you will have to have some knowledge of bilnear pairings to follow the calculations completely, but I hope this gives you a start!