Step1
Make sure the animal and/or child, has truly been left alone. OR, and this can be subjective, is in real danger.
Obviously you need to consider the weather, the child's age, communication skills, is the car running and, obviously without a driver.
Most importantly, you need to decide quickly whether you will need to take action before the police arrive. Check your watch for the time! Remember it for the police/EMS personnel so they have a time line to go by.
If, for example, the child is unconscious and appears to be dry (not perspiring) on a hot day in a hot car, they may already reached a critical stage, requiring you to take immediate action.
You may need to take a towel, a coat, anything to protect your hands and face, as well as the child's, and break open a window to immediately rescue the child.
Do this in an area of the car farthest away from the child or animal, in order to get them out. If you delay, it may cost the child it's life if you delay.
You absolutely should not be charged with a crime for breaking open someone's car window, if you are in the process of rescuing a living creature or child. Especially a child. There is a thing called "Good Samaritan Law" that protects people who stop and help. It is supposed to protect people from unnecessary lawsuits just because they helped.
And, if you have anyone else around, by all means, ask them to stick around as witnesses. If they can't, ask them to leave their name and phone number for the police to contact for information.
Step2
Call 911 (have someone call!) or whatever emergency service number is active for your area, to get the police and/or Humane Society there.
Be sure to give the 911 call taker, who is usually NOT the person who will dispatch the emergency personnel, the best description of the area you, and the car with the child/animal are in.
An accurate description of the car is crucial, as you most likely will be in a parking lot. And, if it a big one, try to find something to put on the antenna to identify it easily.
It is mandatory that you impress on the dispatcher at what point of danger the child may be in. Also you really should stay with the car whether you get the child/animal out yourself or not. Although it may seem obvious, some people do not.
You are very much needed, as a witness, if the police should determine that child neglect has occurred. You will be able to give police a time frame,what you saw and why you believed the child or animal was in danger.
You will be able to testify that the occupant was alone for at least as long as you observed them. Chances are, that when the owner/driver of the car is found, they will say that they were only in the store, office, etc. for "5 or 10 minutes." Everyone says this. It is like when asked "how many drinks have you had?" It is always "TWO."
IF the driver/parent/owner gets to the car, before the police, try to remain calm and just express your concern. Do not antagonize them. Do not accuse them of anything. Simply say you understood why they had to leave the child or animal, even though this probably isn't what you are thinking, in order to keep yourself safe from this person.
If they leave with the child or animal, before the police arrive, write down the license plate number, description of car, driver and the direction of travel, and any other information you can relay.
You will need to call 911 back and tell them to tell the police/rescue which direction the vehicle was headed when they left.
Step3
Finally, if you have taken a CPR course or any other kind of special training for this, use it!.
If not, try to take the child's pulse and respiration by simply listening to their breaths if they are unconscious.
Remove them from the car and get the child or animal, inside somewhere air-conditioned. They could use water, but don't try to force them to drink anything by gulping it. If you do have a liquid, use tepid, not ice cold, water. Give the child small sips of the water and don't let them swallow it all at once. Cool towels or wet rags can be draped over the child's body and forehead to cool them down. Be sure that they are checked out by medical personnel.