I will try to give an answer. First, we use postulate (2). Imagine I am inside a train moving with some velocity and you are watching me from outside. Suppose, I shine a light in a direction perpendicular to the movement of the train. Suppose it takes time $ \Delta t $ to reach to the ceiling of the train. If the distance between the torch and the ceiling is $\Delta x$, the postulate (2) implies
$$ \frac{\Delta x}{\Delta t} = c$$
Now consider the situation in your frame. Now because of the movement of the train, the light doesn't travel purely in the perpendicular direction and is now slanted. Therefore, it travels a distance $\Delta x'> \Delta x$ when it reaches the ceiling. Now for postulate (2) to hold, you need to measure the speed as $c$, i.e
$$ \frac{\Delta x'}{\Delta t'} = c$$
where $\Delta t'$ is the time it took for the light to reach to the top according to you. This immediately implies $\Delta t' \neq \Delta t$. This means, we need to account for difference in time as well as distance when we change frames of reference. Generally (2) implies
$$ c^2dt^2 - d\vec{x}^2 = 0$$
in all frames. Now this alone doesn't show the invariance of the line element $ds^2$ for all space-time events. This is where Postulate (1) comes in. Suppose we have a wave traveling at the speed of light in some frame. It obeys the equation
$$ \left ( \frac{1}{c^2} \frac{\partial^2}{\partial t^2} - \nabla^2 \right)f = 0$$
Now suppose we have another frame. The wave equation should be invariant as the physics shouldn't change by postulate (1). Therefore we must find a transformation that keeps the wave equation intact. This is precisely the Lorentz transformations. Furthermore, it turns out the lorentz transformations leave $dsˆ2$ invariant for $\textbf{all}$ spacetime events.
Hope this helps.