An easy question about the separability of $L^p(X,\mathcal{A}, \mu)$ space, where $p\in [1,+\infty)$ The theorem we have to prove is the following:
Theorem 1. Let $(X,\mathcal{A},\mu)$ be a measure space such that
$(i)$ the space $(X,\mathcal{A})$ is separable, that is exists a countable collection $\mathcal{C}\subseteq\mathcal{P}(X)$ such that $\sigma_0(\mathcal{C})=\mathcal{A}$;
$(ii)$ $\mu$ is a sigma-finite measure.
Then for each $p\in [1,+\infty)$ the space $L^p(X,\mathcal{A},\mu)$ is separable, that is it has a dense subset.
The proof makes use of the following important
Lemma Let $(X,\mathcal{A},\mu)$ be a finite measure space. Let $\mathcal{C}\subseteq\mathcal{P}(X)$ a collection such that $\sigma_0(\mathcal{C})=\mathcal{A}$; let $\mathcal{A}_0:=\mathcal{A}_0(\mathcal{C})$ the algebra generated by $\mathcal{C}$. Then for all $F\in\mathcal{A}$ and for all $\varepsilon >0$ exists $G\in\mathcal{A}_0$ such that
$$\mu(F\setminus G)+\mu(G\setminus F)<\varepsilon$$
Notation $\sigma_0(\mathcal{C})$ is the sigma- algebra generated by $\mathcal{C}$.
We divide the proof of Theorem $1$ into steps:
Step 1. Let $(X,\mathcal{A},\mu)$ be a measure space. Then for each $p\in [1,+\infty)$ the set of measurable simple functions with rational coefficient $$\mathcal{S}_{\mathbb{Q}}:=\{s\in \mathcal{S}(X,\mathcal{A})\;|\; s(X)\subseteq\mathbb{Q}\}$$ is dense in $L^p(X,\mathcal{A},\mu)$
Notation $\mathcal{S}(X,\mathcal{A})$ denote the collection of measurable simple function.
Step 2. For all $f\in L^p$ e for all $\varepsilon > 0$ exists $t\in\mathcal{S}_{\mathbb{Q}}$ such that
$$\boxed{\mu(\{t\ne 0\})<\infty,\quad ||f-t||_p<\varepsilon}$$
This step is proved using the step 1 and the fact that $\mu$ is sigma-finite.
Step 3. We suppose that $\mu(X)<\infty$. As the space $(X,\mathcal{A})$ is separable, exists a countable family $\mathcal{C}\subseteq\mathcal{P}(X)$ such that $\sigma_0(\mathcal{C})=\mathcal{A}$. The algebra $\mathcal{A}_0:=\mathcal{A}_0(\mathcal{C})$ generated by $\mathcal{C}$ is countable and also the set $$\mathcal{S}_{\mathbb{Q},\mathcal{A}_0}:=\bigg\{\sum_{k=1}^n c_k\chi_{G_k}\;|\; G_k\in\mathcal{A}_0, c_k\in\mathbb{Q}, n\in \mathbb{N}\bigg\}.$$
It is simple to prove with the help of the Lemma that $\mathcal{S}_{\mathbb{Q},\mathcal{A}_0}$ is dense in $\mathcal{S}_{\mathbb{Q}}$.
Step 4.
Therefore, let $f\in L^p$ and we fix $\varepsilon >0;$ then for the step 2. exists $t\in\mathcal{S}_{\mathbb{Q}}$ such that
$$\mu(\{t\ne 0\})<\infty\quad ||f-t||_p<\varepsilon/2$$
then for what has just been said exists $s\in\mathcal{S}_{\mathbb{Q},\mathcal{A}_0}$ such that $$||t-s||_p<\varepsilon/2$$ therefore results:
$$||f-s||_p\le ||f-t||_p+||t-s||_p<\varepsilon/2+\varepsilon/2,$$
where we used the step 2., since the space is finite.

Question. Why can we deduce from step 2 that it is not restrictive to assume that $\mu(X)<\infty$?

Answer: The only trivial idea that comes to mind is to consider the finite measure subspace $$\bigg(Y,Y\cap\mathcal{A}, \mu|Y\cap\mathcal{A}\bigg),$$ where $Y:=\{t\ne 0\}$.
 A: Once you have proven the desired result for finite measures you may argue as follows for the $\sigma$-finite case. First, choose a partition $X=\bigcup_nA_n$ where $0<\mu(A_n)<\infty$ (the $A_n$ are pairwise disjoint).
The measure $\mu=\sum_n\mu_n$ where $\mu_n(\cdot)=\mu(\cdot\cap A_n)$. Each $\mu_n$ is a finite measure.
Now, applying the result to each $\mu_n$ you obtain a countable collection $\mathcal{S}_n$ of simple functions that is dense in $L_p(\mu_n)$. As each $\mu_n$ is concentrated on $A_n$, one may assume without loss of generality that the elements in $\mathcal{S}_n$ are carried by $A_n$, that is, each $s\in \mathcal{S}_n$ satisfies $\{|s|>0\}\subset A_n$.
Now, consider
$$\mathscr{S}_n=\{s_1+\ldots+s_n: s_j\in\mathcal{S}_j\}$$
It is easy to check that $\mathscr{S}_n$ is countable and that functions in $\mathscr{S}_n$ are carried by $\bigcup^n_{j=1}A_j$.
Let $f\in L_p(\mu)$ and $\varepsilon>0$. Choose $N$ large enough so that
$$\int_{\bigcup_{n>N}A_n}|f|^p\,d\mu=\sum_{n>N}\int_{A_n}|f|^p\,d\mu<\varepsilon^p/2$$
For each $1\leq n\leq N$ choose $s_j\in\mathcal{S}_j$ such that
$$\int_{A_j}|f-s_j|^p\,d\mu<\varepsilon^p2^{-j-1}$$
Let $s=s_1+\ldots +s_N$. Notice that $s\in\mathscr{S}_N$ and
$$\int_{\bigcup^N_{j=1}A_j}|f-s|^p\,d\mu=\sum^N_{j=1}\int_{A_j}|f-s_j|^p\,d\mu<\varepsilon^p/2$$
In other words
$$\|f-s\|^p_{L_p(\mu)}=\Big\|\mathbb{1}_{\bigcup^N_{j=1}A_j}(f-s)\Big\|^p_{L_p(\mu)} +\Big\|\mathbb{1}_{\bigcup_{n>N}A_n}f\big\|^p_{L_p(\mu)}<\varepsilon^p
$$
The collection $\mathscr{S}=\bigcup_n\mathscr{S}_n$ is dense countable (for each $\mathscr{S}_n$ is countable).

All this shows that it is enough to prove to desired result for finite measures.
