Quick Caramelization: In a large, heavy-bottomed pot or Dutch oven, melt the butter over medium-low heat. Add the sliced onions, sugar, and salt. Cook for 15-20 minutes, stirring occasionally. The onions should be deeply golden brown and very soft—this is the key to the flavor!
Deglaze: Sprinkle the flour over the onions and stir for 1 minute. Pour in the white wine (or sherry) and scrape up any brown bits from the bottom of the pot. Cook until the liquid is mostly evaporated.
Simmer: Add the beef broth, water, and bay leaf (if using). Bring the soup to a boil, then reduce heat and simmer for 15 minutes to allow the flavors to deepen. Remove the bay leaf before serving.
Gratinée (Broiling): Ladle the soup into oven-safe bowls. Place a slice of toasted baguette on top of the soup. Cover the bread and soup surface generously with shredded Gruyère cheese.
Broil: Place the bowls on a baking sheet and broil for 1-2 minutes, watching carefully, until the cheese is melted, bubbly, and beautifully golden brown. Serve immediately.