How do we estimate discount factors? We often talk about time preferences in intertemporal utility maximization problems.

Usually we see some variant of:

$$\max_{c_t}\sum_{t=0}^\infty\beta^tu(c_t)$$
subject to:
$$\sum_{t=0}^\infty e_t=\sum_{t=0}^\infty p_tc_t$$

where $e_t$ is some endowment process over a consumers life time and spending is on a specific consumer good.

I have been thinking how exactly we estimate what $\beta$ is. 

Our usual demand analysis methods only consist of estimating a expenditure function and then recovering underlying preference parameters. Here its tricky though since we are interested in what a discounting looks like.

how do we approach this problem?
There are multiple ways how the discount factor can be estimated. I dont think its possible to make exhaustive review of all of them (within format of this site at least), but one that nicely matches your question would be through estimating the Euler equations.

Following Attanasio &amp; Browning (2009) an Euler equation for general asset would be given by:

$$ E \left[ \frac{c_{t+1}^*}{c_t^*} \right]^{-\gamma}(1+r_{t+1}) \beta = 1 \implies  \left( \frac{c_{t+1}^*}{c_t^*} \right)^{-\gamma}(1+r_{t+1}) \beta = \varepsilon_{t-1}$$

where $c$ is consumption $\gamma$ the coefficient of relative risk aversion, $r$ real interest rate and $\beta$ the discount factor. Authors show that assuming that measurement error is log normal with homoskedastic variance across households and independent then in terms of observed consumption it can be proven it will be equal to $e^{\gamma^2 v}$ where $v$ is the variance of measurement error.  

I will skip all derivations, since they are nicely laid out in the above-mentioned paper itself and for the sake of brevity, but with additional assumptions that the Euler equation will also hold in future $c_{t+2}$ you can derive an estimator based on the following equations:

$$ u_{t+1}^1 = \left( \frac{c_{t+1}}{c_t} \right)^{-\gamma} (1+r_{t+1}) \beta - e^{\gamma^2v}$$

$$ u_{t+2}^2 = \left( \frac{c_{t+1}}{c_t} \right)^{-\gamma} (1+r_{t+1})(1+r_{t+2})\beta^2 - e^{\gamma^2v}$$

where parameters $\beta$, $\gamma$, $v$ are overidentified so we can estimate them using non-linear general method of moments (GMM). Authors call this estimator GMM-LN and they also derive version of it which require a bit less strict assumptions. 

However, the above estimator is not the only way how to estimate discount factors, other ways exist including estimating it experimentally such as for example in Benzion, Rapoport,  Yagil (1989).