It is derived from the observation that after a storm, when the clouds break up, the sun shining through them can make the edges of the clouds look silver.
Here are some examples of how the idiom can be used:
* "I know you're feeling down about losing your job, but remember, every cloud has a silver lining. This might be an opportunity to pursue your true passion."
* "It's been a tough year, but I'm trying to focus on the silver lining - my family is healthy and happy."
* "The pandemic has been difficult for everyone, but there's a silver lining in the fact that people have become more appreciative of their loved ones."
In essence, the idiom encourages us to look for the positive aspects of a situation, even when it seems bleak.