I am of the disposition that has found that keeping such things secret can be much more harmful than discussing it openly. That is my personal bias.
However, you have to judge what is the norm in your workplace, the personality of your boss, and the potential for the event to impact your performance.
For instance, I have relatives I have not seen or spoken to in years. If one of them were to die, I would be sad but it would be something I could easily compartmentalize and not have it affect work. So no need to discuss. That certainly was not the case when my beloved died after 26 years together. I cried at work every day for a year, so it was impossible to hide.
Even the worst boss is also a human being. Almost everyone will understand why the death of a child or a spouse would drastically affect you. Further, If you have brought such things up, you can get bereavement leave and you are more likely to get allowances for any immediate performance problems. People will likely ease your workload for at least the first couple of months. (Incidentally if your boss is one would would not be understanding of such things, that is a huge red flag that this is a very bad place to work, everyone has personal problems eventually.)
Most bosses prefer to know if there is a potential problem, so they can rearrange task assignments, deadlines or whatever might be affected. It is pretty much essential if you are going to take bereavement leave or use your personal vacation time to deal with a situation. It is the professional thing to do to tell them. You can (and should if you value your privacy) ask them not to tell anyone else about it except possibly others like HR would might need to know if there is an accommodation to make. Ask him to talk to you before he talks to any of these other parties.
A benefit of telling such information is that people will reach out to support you in any decent workplace. Co-workers will offer to help with your work load, people will tell you about how they coped through similar times, people may organize food for you or offer to drive you to places you need to go to etc.
The only time I have seen it generate bad feelings when someone told us about a personal issue was when the person was in control of when the thing happened and chose the worst possible time. (She chose to leave her husband the week before a huge deadline and left us stranded with her work undone. And well, frankly, she wasn't well liked either because she was having an affair with the CEO which led to the divorce.)
But when people let us know the issue, people tended to rally round and help.
Sometimes people don't tell and then use it as an excuse after they are reprimanded for poor performance. That, too, does not go over well. If you are going to have performance issues or see that you have started to have performance issues, talk to your boss as soon as you can. People can;t make accommodations when they don't know they need to.
Also be aware that no business can accommodate forever. You have to try to get yourself together as soon as you can.
There are also some things you probably do not want to tell or at least don't want to make a big deal out of. People have been fired for having some diseases like AIDS. Drug abuse is also something that is likely not going to be looked on as a good thing. Expecting performance accommodations for your hangovers is another. A breakup is less likely to get an accommodation than the death of a child. You might be able to take a day or two off, but no one is going to let you mope for weeks and have that not affect your performance evaluation.
No one cares that your pet fish died or you have a flat tire. Telling all the minor things that have gone wrong and treating them like they are major is not a good thing for your career. It makes you look like someone who can't handle ordinary life. People will see you as someone trying to get out of work if you think your flat tire should give you a pass that day for concentrating once you get to work. (Yes this is a real-life example.)
You also ask if there is an appropriate way to tell someone. If the death or event happened when you were not at work and you need to take the next work day off, then use the same channels you would to call in sick. In today's world that is often an email. If, however you are at work when you find out and co-located with your boss, then go tell them in person. If your boss in in another physical location then use the phone by preference and email as second choice.
Telling coworkers is another consideration. If they are going to be asked to take up the slack for you, it is probably best to tell them in general terms. You can just say you are having a personal problem or that you have been diagnosed with a medical issue but do not want to discuss the details. Or you can ask your boss to tell them what you want them told. As a minimum, they need to know you are dealing with a personal problem if it is going to affect there workload.
If you want to keeps things fairly quiet, you can tell people who you consider to be friends if you think they will maintain your secret.