Consider the function
$$\varphi(x)^p := \sum_{k=2}^\infty \chi_{B_k}(x), \quad \forall x \in \mathbb R^n,$$
where $B_k = B(2^k e_1,1)$ and $1 \leqslant p < \infty$. My goal is to show that this function belongs to $L^p_{\text{loc}}(\mathbb R^n)$ and also that
$$ \sup_{x \in \mathbb R^n, r > 0} r^{-\lambda}\int_{B(x,r)} |\varphi(y)|^p \, dy < \infty, $$
for every $0 < \lambda < n$.
My attempt. I think I was able to show that $\varphi \in L^p_{\text{loc}}(\mathbb R^n)$ in the following way:
It is clear that for every compact set $K \subset \mathbb R^n$ there exists some $R > 0$ such that $K \subset B(0,R)$. Therefore, we have that
$$ \int_K |\varphi(y)|^p \, dy \leqslant \int_{B(0,R)} |\varphi(y)|^p \, dy = \int_{B(0,R)} \sum_{k=2}^\infty \chi_{B_k}(y) \, dy. $$
Now, let us count the number of balls $B_k$ that intersect the ball $B(0,R)$: for any ball $B_k$, the balls $B_k$ and $B(0,R)$ intersect if and only if
$$ |2^ke_1 - 0| < R + 1. $$
Solving for $k$, one obtains that the balls $B_k$ and $B(0,R)$ intersect if and only if
$$ k < \log_2(R+1).$$
Clearly, if $R < 3$, we have that $\log_2(R+1) < 2,$ which implies that the balls $B(0,R)$ and $B_k$ never intersect for any $k \geqslant 2$. So, in the case $ R < 3$ we have that
$$ \int_K |\varphi(y)|^p \, dy \leqslant \int_{B(0,R)} \sum_{k=2}^\infty \chi_{B_k}(y) \, dy = 0. $$
Now suppose that $ R \geqslant 3$. In this case we've already seen that $B_k$ intersects $B(0,R)$ for every $2 \leqslant k < \log_2(R+1).$ Hence, it follows that
$$ \int_K |\varphi(y)|^p \, dy \leqslant \int_{B(0,R)} \sum_{k=2}^\infty \chi_{B_k}(y) \, dy = \int_{B(0,R)} \sum_{k=2}^{\lfloor \log_2(R+1) \rfloor}\chi_{B_k}(y) \, dy \leqslant \sum_{k=2}^{\lfloor \log_2(R+1) \rfloor} |B(0,R)| < \infty. $$
Hence we conclude that $\varphi \in L^p_{\text{loc}}(\mathbb R^n)$.
But I don't know how to deal with the second property. Thanks for any help in advance.
Using the same idea that you did for the first part, $$B_k \cap B(x, r) \neq \varnothing\; \implies \; \left|x_1 - 2^k\right| \le \left\|x-2^k e_1\right\| \le r + 1 \; \implies \; \left|x_1 - 2^k\right| \le r+1$$
$$\implies x_1 - (r+1) \le 2^k \le x_1 + (r+1)$$
If $x_1 < 1$, $$B_k \cap B(x, r) \neq \varnothing\; \implies 2^k \le 1 + (r+1) \quad \implies k \le \log_2(r + 2) + 1 $$
If $2^\ell \le x_1 < 2^{\ell + 1}$ and $2^\ell \le 2(r+1)$ then, $$B_k \cap B(x, r) \neq \varnothing\; \implies 2^k \le 2^{\ell + 1} + (r+1) \quad \implies k \le \log_2(3(r + 1))$$
If $2^\ell \le x_1 < 2^{\ell + 1}$ and $2^\ell > 2(r+1)$ then, $$B_k \cap B(x, r) \neq \varnothing\; \implies 2^{\ell} - (r+1) \le 2^k \le 2^{\ell + 1} + (r+1)$$ in this case the number of such $k$ is bounded by \begin{align} \log_2(2^{\ell + 1} + (r+1)) + 1 - \log_2(2^{\ell} - (r+1)) &= \log_2\left(2 + \frac{3(r+1)}{2^\ell - (r+1)}\right) + 1\\ &\le \log_2 2 + \frac1{2\log(2)}\frac{3(r+1)}{2^\ell - (r+1)} + 1\\ &\le 2 + \frac{3(r+1)}{2(r+1) - (r+1)} = 5 \end{align}
Using the fact that $$\left|B_k \cap B(x,r)\right| \le \min \{\left|B_k\right|, \left|B(x,r)\right|\} = \left|B_1\right|\min\{1, r^n\}$$ on can prove that there is a constant $A>0$ such that for every fixed $r>0$, $$\sup_{x\in \mathbb R^n} \int_{B(x,r)} \left|\varphi(y)\right|^p \mathrm dy \le A\left|B_1\right|\min\left\{1, r^n\right\} \log_2(r+1)$$ and you can finish the proof by using the fact that $$r \mapsto A\left|B_1\right|\min\left\{1, r^n\right\} r^{-\lambda}\log_2(r+1)$$ is bounded on $(0,\infty)$.