The word "condolences" is usually used after a death. It's meant to show sympathy toward grieving family members and friends, and console them for the passing of their loved one. We might say "My condolences on the loss of your mother. She was a wonderful person."
The word comes from the Latin "con," meaning "with" and "dolor," meaning "sorrow." So it means to share sorrow with someone. It was first used around 1600, and between about 1600 and 1800, was also spelled "condoleance." A similar word that meant the same thing in that period was "condolement."
There are different ways to offer condolences. They are often expressed in person at a wake or funeral. Often there may be a receiving line at a wake, where visitors can give loved ones some words of comfort, or the sentiment may be expressed more informally by just coming up to someone. After a funeral, people may gather at a home or at a funeral lunch, and offer words of sympathy there as well. Neighbors or co-workers may also condole with the bereaved persons the next time they see them.
There's also a more formal way, and that's by writing a letter. When world leaders pass away, leaders of other countries often send a letter-of-condolence. When someone dies doing an especially heroic act, presidents or other officials may do the same. Another example is that, at John Adams' death, his family received a letter from Thomas Jefferson. When writing a letter, it's best to acknowledge the loss, be sincere, and share some memories.
However it's done, offering condolences at a time of bereavement is a very kind and thoughtful thing to do.