Melt butter in a large pot or Dutch oven over medium heat until foamy but not browned. Add diced onion and cook for 5 minutes until softened and translucent.
Stir in garlic and cook for 30 seconds until fragrant, being careful not to let it burn — dark specks will taste bitter.
Add broccoli florets, broth, salt, pepper, and cayenne (if using). Bring to a boil, then reduce heat to medium-low and simmer for 12-15 minutes until broccoli is very tender when pierced with a fork.
Working in batches, transfer half the soup to a blender or use an immersion blender to puree until smooth. Return everything to the pot. (If using a regular blender, let steam escape by removing the center cap and covering the lid with a towel.)
Reduce heat to low. Sprinkle flour over the surface of the soup and stir gently to incorporate — this prevents clumps. Cook for 2 minutes.
Gradually add cheese one handful at a time, stirring continuously until each addition is melted before adding more. This takes patience but ensures no grainy bits remain. Total melt time should be about 4-5 minutes. The soup is done when it coats the back of a spoon and holds its shape briefly when you draw a line through it with your finger — it won't run away immediately.
Taste and adjust seasoning. Add more salt if needed, or a pinch of cayenne for warmth. Serve hot with crusty bread or crackers.