So, how does mining pool know, if we have actually gone through all the 1000 mega hashes to submit one share to the mining pool (Person A has done more work than person B)?
The mining pool don't know and don't care how many attempts your miner made to solve a share, he care about how many shares you actually solve. (person A and person B get the same rewards if they submit the same number of shares of the same difficulty, regardless of how much work they spend to find these shares)
But person B who has low hashing power already found a share but has not done any work compared to person A
If the person B found the same amount of shares than the person A but with much less work, the person B have been luckier than the person A.
Take in account that not all share have the same difficulty and consequently the same value, typically mining pools serve easier share (which require less work) to slower miners and more difficult ones to faster miners (to better exploit the different speeds).
How does mining pool get to know if Person A has done more work than Person B, as miner does not submit any unsuccessful hashes but the successful ones, but already more work has done.
As already mentioned above, you are not paid for the work you do but for the shares you produce.
The mining pool does not know your hashrate, estimates it based on the speed with you solve the shares and their difficulty: if you are lucky and you find more shares than you should, your hashrate will be overestimated, if you are unlucky and you find less shares the hashrate reported by the pool will be lower than the actual one.