"If markets are competitive, the rate of return on capital equals its marginal product, $f'(k)$ minus depreciation $\delta$"? Consider Solow model with $Y=(AL)^{1-a}K^a$. Then output per effective labor is $y=k^a$ where $k=\frac{K}{AL}$. 

"If markets are competitive, the rate of return on capital equals its marginal product, $f'(k)$ minus depreciation $\delta$"?

How does market competitiveness deduce formally/mathematically the rate of return on capital equals its marginal product, $f'(k)$ minus depreciation $\delta$"? The statement seems plausible but I can't prove it mathematically. What is the formal definition of rate of return on capital here?

The relevant equations are the following. 

$\frac{d}{dt}K=sY-\delta K$ where $s$ is saving rate. Assume labor $L$ and knowledge $A$ grows exponentially at rate $\delta,g$ respectively. 

Reference. Romer Advanced Macroeconomics, Chpt 1, Sec 1.5
This is not proven in Romer but it is a well known result. To derive it mathematically you need to take the following steps:

First, the capital as in Romer depreciates so the evolution of capital will be given:

$$k_t = k_{t-1} + i_t- \delta k_{t-1} \tag{1}$$

where $k_t$ is the present stock of capital, $k_{t-1}$ previous stock of capital, $i_t$  is investment (where investment is equal to savings $s$) that increases the capital and $\delta$ is depreciation. 

Next to increase the stock of capital the producer/investor needs to pay price $P_t$ for output that is going to be saved and converted to capital through $i_t$. Assuming that we will hold labor constant the reward that producer gets for this sacrifice is the marginal product of capital - as when labor is held constant the output $y_{t+1}$ will increase only by the additional marginal product that the increase in capital brings $f'(k)$. Moreover, we can assume that in the next period the capitalist can sell their remaining capital $(1-\delta)$ as well at price $P_{t+1}$. 

Consequently the net nominal return on the investment will be: $P_{t+1}(f'(k_t) + 1 -\delta) - P_t$ and the nominal rate of return to investment will be given by:

$$ (P_{t+1}(f'(k_t) + 1 -\delta) - P_t)/P_t \tag{2} $$

This can be simplified as:

$$ (1-\pi_t) (f'(k_t) +1-\delta) -1 \tag{3}$$ 

where $\pi_t$ is the inflation rate $(P_{t+1}+P_t)/P_t = \pi_t$.

Whether the producer/investor is interested into the above investment depends on how other returns such as those on bonds or on debts used to finance investment behave. Lets call those returns $R_t$.

Now if we assume perfect markets, rational investor will invest into capital when the nominal return on capital is higher than the returns on bonds/debt $R_t$, but as economy accumulates more and more capital the marginal product of capital declines as it becomes more scarce (and vice versa if the return on bonds/debt is higher) and thus in competitive markets rational agents will invest up until:
$$ (1-\pi_t) (f'(k_t) +1-\delta) -1 = R_t \tag{4}$$ 

Furthermore, the nominal rate on return on bonds $R$ has to also satisfy the fisher equation:

$$(1+r_t) = (1+R_t)/(1+\pi_t) \tag{5}$$

where $r_t$ is the real rate of return. The fisher equation basically says that the real rate of return must be equal the nominal rate minus inflation as the above function can be approximated as $r_t \approx R_t - \pi_t$ using the fact that $\ln(1+x)\approx x$ for $x\approx 0$ (this comes from Taylor expansion). This must hold as people in the market should care about real returns and thus they should expect to be compensated for inflation when they set nominal interest rates.

Solving the Fisher equation (4) for the $R_t$ and substituting into the equation (5) which equates the nominal returns between capital and bonds/debt gives you the desired result:

$$r_t = f'(k_t)- \delta \tag{6}$$

The last equation says the real return to capital will be equal to marginal product minus depreciation.

The intuition is simple, if markets are competitive then you will invest into the capital as long as it provides higher returns than other investment. But the more you invest into the capital the smaller its marginal product and hence nominal return will be. At some point people invest into capital so much that the marginal product minus depreciation (which has to be taken into account as it decreases the value of the capital) is just equal to the real return. Also if capital would started with lower return than bonds/debt people would just invest into those until the returns will be equalized. The assumption of perfect market is important as in presence of market imperfections the equality established by eq (4) might not necesarry hold (or to be more precise it would have additional parameters which would end up in the result as well).