If a company issues shares in month ten, those shares only count for a sixth of the year. That is why a buyback executed in December barely helps this year's eps but helps the whole of next year's.
There are two versions: basic, which counts shares actually outstanding, and diluted, which adds the shares that options and convertibles would create. See basic-versus-diluted-eps.
Example: Northwind starts the year with 40.0M shares and buys back 2.0M evenly across the last quarter. Ending shares are 38.0M, but the weighted average is about 39.75M, so this year's EPS benefit is only a quarter of the full effect.
Related: basic-versus-diluted-eps, eps, share-count-trend, capital-allocation