The process of going form the first to the second is a bit more difficult, but it's called breaking a fraction into partial fractions.
You basically do it by establishing an equation like:
then multiply by the denominator to get:
and compare terms on each side.
Get and , so .
This process can be repeated on the remaining fraction:
Multiply to get:
Compare terms again, and this time get , and .
Put it all together: