Too many men wear black socks with their ensembles, in my opinion. And unless a man is wearing evening trousers and black shoes, black socks just create a visual interruption where there should be either a smooth flow or else something to delight the eye.
On dressier occasions socks should be similar to the trouser, not the shoe, and that includes texture as well as color. Wear heavier weight gray socks with heavier gray trousers, and lighter weight navy versions with lighter weight blue. Slightly more advanced dressers may add a contrasting pattern in that similar color and texture. A large herringbone works nicely. A vertical stripe begins to get a bit racy.
When proper sobriety is not required, all bets are off. Socks might pick up the color of something above the waist like the jacket or the pattern in a necktie, or just generally complement without matching like the light gray birdseyes in the photo.
But save the black socks for evening wear.