I thought I'd do it the way the book said and keep the other answer up so you can compare the two.
Let $Y$ be the distance of the ambulance to the central point and let $J$ be the number of the street the ambulance is on.
Fix a value of $y = \frac ab$ for natural numbers $0< a< b$. We want to know the probability that $Y<y$.
First, it doesn't matter what street the ambulance is on the probability that $Y<y$ doesn't change
if you know what street the ambulance is on.
Now let's divide the street up into $b$ portions with equal lengths. As the amblance is equally likely to be anywhere
in the street the probability that it is in any one of the $b$ parts is $\frac 1b$.
Now there are $a$ of these parts that are closer to the centre than $\frac ab$ and $b-a$ of them that are further away.
So the probability that the ambulance is less than $y$ miles away from the centre is
$$\mathbb P[Y<\frac ab] = a\times \frac 1b = \frac ab = y$$
The probability that the ambulance is more than $\frac ab$ miles away from the centre is
$$\mathbb P[Y>\frac ab] = (b-a)\times \frac 1b = \frac {b-a}b = 1-y$$
Now let $D_i$ be the event that $J=i$.
The events $D_i$ are disjoint, they cannot occur together, so we have
$$ \mathbb P[X < x] = \sum_{i=1}^4 \mathbb P[X< x \cap D_i]$$
$$ \hphantom{\mathbb P[X < x]} = \sum_{i=1}^4 \mathbb P[X< x |D_i] \times \mathbb P[D_i] $$
Now we need to calculate $\mathbb P[X<x | D_i]$ for each $i$.
For $i=1$ The distance to the end of street one is $X = 1-Y$. So we can say that
$ \mathbb P[X< x |D_1] = \mathbb P[Y> 1-x] = 1-(1-x)=x$ for $x<1$ and $P[X< x |D_1] = 1$ for $x\geq 1$.
For $i = 2, 3$ or $4$ the distance to the end of street one is $X=Y+1$.
Therefore
$ \mathbb P[X< x |D_i] = \mathbb P[Y< x-1] = x-1$ for $x>1$ and $P[X< x |D_1] = 0$ for $x\leq 1$.
Now for every $i$ we must have $\mathbb P(D_i) = \frac 14$.
Notice that the last three terms of the sum are all the same so we may write
$$ \mathbb P[X < x] = \sum_{i=1}^4 \mathbb P[X< x \cap D_i]$$
$$ \hphantom{\mathbb P[X < x]} = \mathbb P[X< x | D_1]\mathbb P(D_1) + 3\times\mathbb P[X< x | D_2]\mathbb P(D_2)$$
So for $x<1$ we have
$$ \mathbb P[X < x] = x\times \frac 14 + 3\times 0 \times \frac 14 = \frac x4$$
And for $x>1$
$$ \mathbb P[X < x] = 1\times \frac 14 + 3\times (x-1) \times \frac 14 = \frac {3x-2}4$$
I took quite a few shotcuts last time. Firstly, I combined $D_2$, $D_3$ and $D_4$ into one event $E^\complement$.
This didn't affect the conditional probabilities for $X<x$. All it meant was I had a $\mathbb P(E^\complement)$ insted of
$3\mathbb P(D_2)$ and I didn't have to use the sum.
Probably the biggest difference is that in my original answer I didn't explicitly use $\mathbb P[x<X|D_i]$.
Instead I introduced $Y$ and talked about the problem in terms of independence.
I'm sorry if this confused you, there are some technical reasons for doing it that way which really don't matter at this level.
I also didn't make the point that for $x>1$ $\mathbb P[X< x | D_1] = 1$ this is obvious when it's pointed out
(if the ambulance is on street one it's less than $x$ miles away if $x>1$.)
But it probably wasn't helpful that it just appeared in an equation near the end with no explanation.