How can perfectly competitive firms earn zero profits?
First, let's deal with the semantics and terminology aspect: what the word "profit" means in Economics, and what the word means in the everyday/business/accounting use, are two different things. 

In its everyday business use "profit" is the surplus above all expenses including depreciation. So what business call "profit" the Economics discipline calls "net return to invested capital".

In Economics on the other hand, "profit", although never really "officially" defined universally, it essentially means "excess returns to capital above the market level", where the "market level", sometimes means "average level" sometimes it means "perfect competition level", or some other notion of equilibrium returns in the absence of exploitation of market frictions, market power and the like. 

Perfectly competitive firms earn zero profits because perfect competition drives prices down to average cost - but where in "cost" we include what business call profits, because for us, it is payment to capital used in production. 

Now let's consider the specific example of the OP, where "for simplicity" we have a single production factor, and where, the production function is strictly concave:

$$Q= F(L), \;F'&gt;0, \;F''&lt;0$$

The profit maximization problem here is 

$$\pi = pQ - wL,\;\; \text{f.o.c.}: \;pF' = w \implies L^* = (F')^{-1}(w/p)$$

$$\pi^* = pF - pF'L = p(F-F'L)$$

For zero profits we should have

$$\pi^*=0\implies F - F'L = 0 \implies \frac {F}{L} = F'$$

or that average product in real terms equals marginal product. As long as the functional form of the production function is such that there is a positive level of $L$ for which this equality can hold, the argument of the theory is that competition will push the price to a level where the level of labour chosen will be such that all revenues go to payments for labor.  

And if the production function does not allow for such an equality, then it simply is not compatible with a perfectly competitive market structure.  

The OP should figure out how and why the diagram used in their post is misleading.