Preheat the oven to 350 degrees F. Get a 9 x 13-inch baking dish (or something equivalent) and set it aside.: As the oven warms, you will sense a dry heat building which promotes even baking and gentle bubbling without burning the top; properly preheating ensures the gratin sets evenly, and if you skip this you risk uneven cooking where edges finish before the center is done.
To the medium saucepan, set over medium heat, add the butter. When melted, add the garlic and cook for about 1 minute, until fragrant. Add the flour and stir until combined with the butter; cook for 1 minute. Pour in the milk and bring to a simmer, stirring frequently in order to prevent any lumps. Cook until mixture begins to bubble and thicken, about 5 minutes.: The dish size dictates the thickness of the layers, using the recommended size helps the potatoes cook through in the allotted time, and a ceramic or glass dish will conduct heat differently than metal so adjust if your pan is much deeper which can trap extra moisture and lengthen cook time.
Turn the heat off and mix in the Gruyère cheese, leaving 1/4 cup for the top. Stir until melted. Give it a taste and add salt and pepper to your liking. I added about 2 teaspoons of salt and a teaspoon of freshly ground pepper.: When the butter melts you should see it foam gently and smell a rich dairy aroma, this is the base for your roux that will bind the sauce, and avoid letting it brown which would shift the flavor profile toward nuttiness instead of the clean dairy backbone you want.
To the baking dish, add an even layer of the potatoes. Add a few spoonfuls of the cheese sauce and top with a few dollops of goat cheese. Repeat until you’ve worked through all of the potatoes and cheese sauce. Cover with foil and transfer to the oven to bake for 1 hour and 15 minutes.: The sizzling and fragrant lift of the garlic signals that its oils are releasing, you want that aromatic note without browning which turns bitter; if the garlic darkens reduce the heat immediately to prevent off flavors.
Remove the foil and sprinkle the last bit of cheese on top. Return to the oven and bake for an additional 15 minutes, until golden brown.: The flour should bloom in the fat, creating a slightly pasty texture that loses its raw smell, this step creates the thickening power for the milk and skipping it will leave a raw flour aftertaste, stir continuously so no lumps form.
Pour in the milk and bring to a simmer stirring frequently to prevent any lumps: As the milk warms you will notice the sauce thinning then gradually thickening, gentle bubbling at the edges is your cue that gelatinization is happening, stir frequently and scrape the bottom to keep the texture smooth; if it scorches you will taste burnt dairy, so moderate the heat.
Cook until mixture begins to bubble and thicken about 5 minutes: The sauce should coat the back of a spoon and show a glossy sheen, this indicates proper thickening which will cling to the potatoes ; under thickening will produce a runny gratin while over thickening can become pasty, so watch for this coating cue.
Turn the heat off and mix in the Gruyère cheese leaving 1/4 cup for the top: As you stir the shredded Gruyère cheese into the hot sauce you will hear a soft melting sound and see the sauce smooth out, this melting step enriches the sauce and integrates savory depth, adding cheese to a too cool sauce will result in clumps instead of a silky texture.
Stir until melted give it a taste and add salt and pepper to your liking: Taste will guide your seasoning, the combination of Kosher salt and freshly ground pepper balances the dairy; I typically add about 2 teaspoons salt and 1 teaspoon pepper but adjust to your palate, under seasoning is the usual mistake so taste before assembling.
To the baking dish add an even layer of the potatoes: Lay the thinly sliced potatoes so they overlap slightly and form a smooth, even bed, this helps them cook uniformly and soak up the sauce; uneven placement can create thick spots that remain firm after baking.
Add a few spoonfuls of the cheese sauce and top with a few dollops of goat cheese: The contrast between the warm, creamy sauce and the tangy, cool dollops of goat cheese creates flavor pockets, distribute them across the layers so each bite can have a tangy surprise, avoid placing all dollops in one area or you will get inconsistent flavor distribution.
Repeat until you’ve worked through all of the potatoes and cheese sauce: Building uniform, alternating layers ensures every slice has balanced creaminess and tang, keep the layers consistent in thickness, a common error is piling too many slices in one layer which prevents even cooking.
Cover with foil and transfer to the oven to bake for 1 hour and 15 minutes: Covered baking traps steam so the potatoes become tender and the sauce sets, you should hear gentle bubbling through the foil as the sauce simmers; baking uncovered too early will dry the top and prevent the interior from fully cooking.
Remove the foil and sprinkle the last bit of cheese on top: Uncovering allows the surface to brown and the reserved Gruyère cheese to toast, you will see the top transform from pale to a warm, golden color and smell nutty, a misstep is leaving it covered, which keeps the top pale and soft instead of providing the desired golden crust.
Return to the oven and bake for an additional 15 minutes until golden brown: In this final stage you will hear soft bubbling and see golden spots form, the finished gratin should be bubbling at the edges and have a satisfyingly crisp top while the interior remains creamy, watch carefully as a few extra minutes can quickly shift from golden to overly browned.