Due to the linearity of the utility function the utility maximization problem for individual $i$ has either one of the two corner solutions, or it is indeterminate.
The individual $i$ has to solve the following problem
$$\max_{x_{1i},x_{2i}}[ x_{1i} + \beta_i x_{2i}]$$
$$s.t. x_{2i} = 1-(1+r)x_{1i}, \;\;x_{1i} \geq 0,\;\;x_{2i} \geq 0 $$
Solvency is also imposed -i.e. the individual cannot borrow in the first period more than what he can repay in the second period (including interest).
One can deduce that
$$\text {"flatter" budget constraint:}\;\; -(1+r) > -\beta_i^{-1} \implies \{x_{1i}^* = (1+r)^{-1},\;\;x_{2i}^* = 0\} $$
$$\text {"steeper" budget constraint:}\;\; -(1+r) < -\beta_i^{-1} \implies \{x_{1i}^* = 0,\;\;x_{2i}^* = 1\}$$
.."steeper" and "flatter" with respect to the utility (linear) indiference map, and with $x_{2i}$ in the vertical axis.

Working the implied inequalities we re-write the solution as
$$\beta_i < \frac 1{1+r} \implies \{x_{1i}^* = (1+r)^{-1},\;\;x_{2i}^* = 0\}$$
$$\beta_i > \frac 1{1+r} \implies \{x_{1i}^* = 0,\;\;x_{2i}^* = 1\}$$
In the $N$-identical individuals case, and with $\beta_i, i=1,...,N$ being a random variable we can only talk about expected demand in the first period, denote it $E(d_{1i})$ for the individual and $E(D_1) = N\cdot E(d_{1i})$ on aggregate.
We have
$$E(d_{1i}) = \frac 1{1+r} \cdot \Pr\left[\beta_i < \frac 1{1+r}\right] + 0 \cdot \Pr\left[\beta_i > \frac 1{1+r}\right] $$
The second term vanishes.
Given the assumptions on the distribution of the $\beta$'s its density function over the domain is $f(\beta_i) =2$ and so the remaining probability is (as long as $r \leq 1$)
$$\Pr\left[\beta_i \leq \frac 1{1+r}\right] = \int_{1/2}^{(1+r)^{-1}}2{\rm d}\beta_i = 2\left(\frac 1{1+r}-\frac 12\right) = \frac {1-r}{1+r}$$
and so we have
$$E(D_1) = \frac N{1+r}\cdot \frac {1-r}{1+r} = \frac {1-r}{(1+r)^2}N$$
which is decreasing in $r$.
If $r$ hits unity, expected demand will be zero -because
a) It would place a solvency ceiling to loan demand to be not higher than $1/2$ so that with interest rate $100\%$ all production of the second period would then be needed to repay the loans. This means that with $r=1$, maximum consumption (and utility) in the first period will not exceed $1/2$.
b) the discount factor being greater or equal than $1/2$, implies that by taking zero loan in the first period, one would enjoy the full unitary production of the second period, with utility higher than $1/2$. So for non-zero demand for loans in the first period, it must be the case that this demand can exceed $1/2$. When $r\geq 1$ it cannot, hence the zero expected demand.
Note: if instead of a "stochastic distribution" of the $\beta$'s we think of a "uniform allocation" of them in the $[1/2,1]$ interval, then we can think of expected demand as deterministic demand.