In a large pot, whisk to combine the sugar and flour. Pour in the milk while whisking constantly until smooth.
Cook the milk mixture over medium-high heat, whisking frequently, for 6 to 8 minutes, or until simmering. Reduce the heat to medium-low to maintain a simmer. Whisk constantly, for 1 to 2 minutes, until the mixture thickens like pudding. Remove it from the heat.
Pour the mixture into a medium bowl and press parchment paper or plastic wrap into the surface. (This prevents a skin from forming). Let it cool to room temperature, about 3 hours. (This can be made in advance and refrigerated overnight; just be sure to return it to room temperature before proceeding with the recipe.)
In the bowl of a stand mixer fitted with a paddle attachment, beat the butter and salt on medium speed for 2 minutes until smooth and creamy. Scrape down the sides and bottom of the bowl.
To the bowl with the butter, add the cooled flour mixture 2 to 3 tablespoons at a time, mixing on medium-low speed until fully combined, in between each addition. Stop and scrape down the sides and bottom of the bowl frequently to ensure the mixture is fully mixed together before adding more of the flour mixture.
Add the vanilla. Increase the mixer to medium speed and beat the mixture for about 1 minute or until the frosting is smooth, light, and airy.
Notes
Once the roux starts to bubble, don’t stop whisking. If you do, you risk the mixture sticking to the bottom of the pot and burning.
Use softened butter. It is important to use butter that has been softened to room temperature and that the flour mixture is also at room temperature. If either part is too warm or too cold, it will not emulsify (or mix together properly), and the icing will appear curdled and split. If you forget to set the butter out ahead of time, follow my easy tutorial for how to soften butter in a few minutes!
If the mixture is too warm: Put it in the refrigerator for 10 minutes, then beat it again on medium speed for about 30 seconds.
If the mixture is too cold (cold to the touch): Allow it to sit in a warm place for about 20 minutes, then re-whip it on medium speed for about 30 seconds.