Oddly most of us don't know what we should and should not be doing. Pay attention and read closely so you remember this should it ever happen to you.
DOs
If the driver asks if you are okay say "I don't know. I think I need to see a doctor." You might feel unhurt, because of the shock of being struck, so you don't always know when you are injured. You might notice until hours later that you have a cracked rib, an injured ankle, a torn ligament, etc.
Do get the driver's phone number.
Do get the driver's insurance info.
Do write down the driver's license plate.
Do call the police and report the accident.
Do document the scene, photograph your bicycle, the car, any injuries, the driver's face, your face, etc. Take photos of everything you can think of.
Do locate witnesses who saw the accident and get their contact info / phone numbers if possible. Or alert the police to which witnesses saw the accident.
Do go see a doctor as soon as you are able. You might have an injury you didn't notice at the time. If you do have an injury get copies of all medical reports relating to the injury.
Do report any injuries, no matter how minor, to the insurance company. Insurance companies take that stuff seriously, even if it is only a minor injury. If you only claim property damage and no injuries, insurance companies take it less seriously and are less likely to pay anything at all. You don't want to fake any injuries obviously, but you shouldn't be pretending not to be injured just because you don't want to cause extra trouble. As long as you record any injuries and see a doctor ASAP, you are preserving your rights. Let your doctor decide what is worth noting on your insurance claim.
Do follow through on protecting your rights.
DON'Ts
Do not accept the driver's word when they say they will pay for any damages. They can easily change their mind later, and change their story to claim that the accident was your fault: "He just came out of nowhere! He was going ridiculously fast and it was impossible to stop on time!" After all, why should they risk paying higher insurance rates if they can get away with paying nothing and pretending the accident never happened?
Never admit to being "okay". Just keep saying that you don't know and that you need to see a doctor.
Do not refuse to go see a doctor. See one ASAP.
Do not let the driver leave before the police arrive. If they attempt to do so record their license plate and report it to police as a hit and run, as they clearly didn't stick around at the scene of the crime. If a driver gets out of their car, asks if you are okay, and then immediately leaves that still counts as a hit and run.
Do not get your bicycle repaired immediately. Preserve the evidence and record all the damage. Get a bicycle mechanic to give you an estimate for the repairs, but don't have them fix it yet.
Do not assume that everything will be taken care of properly. Insurance companies and deadbeat drivers would much rather not have to pay anything if they think they can get away with it.
Do not mention the value of your bicycle. The price of the repairs will be determined by your bicycle mechanic. Just say "It depends on the repair bill."
If it is a friend, a family member, or even a random stranger that you see get hit stop and help them and then follow the above advice. It could happen to any of us. See the video below of strangers stopping to help a little girl after she gets rammed into by a car.