I have a question about a step in a proof in Badescu's "Algebraic Surfaces" (p. 2):
Why the conditions that the $k$-scheme $X$ is integral and algebraic ensure that for an invertible sheaf $\mathcal{L}_1$ there exist a Cartier-Divisor $D$ with $\mathcal{L}_1 = \mathcal{O}_X(D)$?
What could failure if the given scheme $X$ wouldn't have this properties?

Here are some results in both directions that I became aware of from reading [Lazarsfeld, §1.1]. We denote by $$l\colon \operatorname{Div}(X) \longrightarrow \operatorname{Pic}(X)$$ the canonical homomorphism sending a Cartier divisor to its associated line bundle. The kernel of $l$ is the subgroup $\operatorname{Div.princ}(X) \subseteq \operatorname{Div}(X)$ of principal Cartier divisors [EGAIV$_4$, Prop. 21.3.3(i)].
When $l$ is surjective
The first result directly answers your question about why integrality is sufficient for $l$ to be surjective.
Proposition [EGAIV$_4$, Prop. 21.3.4]. Let $X$ be a scheme such that one of the following properties holds:
Then, the canonical homomorphism $l$ is surjective.
On the other hand, even without integral hypotheses, one has the following:
Theorem [Nakai, Thm. 4]. Let $X$ be a projective scheme over an infinite field $k$. Then, the canonical homomorphism $l$ is surjective.
Note that in any of these cases, the homomorphism $$\frac{\operatorname{Div}(X)}{\operatorname{Div.princ}(X)} \longrightarrow \operatorname{Pic}(X)$$ induced by $l$ is an isomorphism.
When $l$ is not surjective
We have the following:
Theorem [Kleiman, §2; Schröer, §2]. There exist non-reduced thickenings of
such that the canonical homomorphism $l$ is not surjective.
The original version of example 1 is due to Kleiman (see [Kleiman, §2]), and a similar example appears in [Schröer, §2.1]. An erroneous version of Kleiman's example first appeared in [Hartshorne, Ex. 1.3]. The threefold one starts with is Nagata's [Nagata, Ex. 2] and Hironaka's (see [Hartshorne, App. B, Ex. 3.4.1] or [Shafarevich, §6.2.3]) for Kleiman's and Schröer's examples, respectively.
Example 2 is due to Schröer [Schröer, §2.2].