ATP = adenine triphosphate and can be simply regarded as a phosphate donor.
Three phosphate groups are added to the mevalonate. Two are added to the terminal hydroxyl end and one is added to the C-3 hydroxyl.
The phosphate on C-3 and the nearby carboxyl group leave creating a double bond within a 5 carbon intermediate. This is the first of the isoprene units. Isopentenyl pyrophosphate.
Activated isoprene. (An isoprene unit with 2 phosphate groups attached.)
A [1,3] hydrogen shift readily occurs to give Dimethylallyl pyrophosphate, but this is reversible.
This isomerisation of isopentylpyrophosphate yields the second isoprene unit.