The story is <PERSON> "The City and the Stars".
It's about how in the past humanity discovered they weren't alone as well as being left behind
The story is about the remains of humanity, who decided, more than a billion years before the events of the novel, to remain on Earth when most of humanity left the galaxy.
humanity is split on a desert earth with two human remains
The story takes place about two billion years in the future, Earth has become a desert save for two places.
one group of immortal people with high tech
The people living in the city (Diaspar) live in bodies that are created for them by the city's central computer. The bodies themselves are not immortal, but at the end of their lives, the people upload their memories into the computer. 240
When it's a person time to "live again", a new body will be created and, after their childhood, the memories of the person are implanted into the body.
The main character is immortal
He is an inhabitant of the city.
not immortal hippies who are psychic
The other place on earth, Lys, is home to "normal" humans, who have rejected most machines and are born, age and die naturally. They are telepaths who can communicate without words over great distances.
Then the races of the universe tried to create a god in the a form of a being made out of magnetic field.
Over a billion years before the events of the novel, scientists worked on the creation of an disembodied intellect. The first attempt had created a powerful but insane being, the Mad Mind.
Then that creature killed all of them.
The beat the first thing by putting it in a black hole
It did not kill all of them (only a lot) before it was imprisoned in a "strange artificial star" called the "Black Sun".
but it got out by going faster than light.
The first being is still trapped, but it is hinted, that it would escape eventually.
But before they all died they made another one and this one was innocent and stuff.
The second being (<PERSON>) was created after the imprisonment of the first being and was created to destroy the first one, which would one day escape its prison.
and I the end of the book he beats the thing that killed everyone with friendship.
This does not happen in the novel. 322