Start by preheating the oven to 350 degrees Fahrenheit (175 degrees Celsius). Then, line the baking pan with parchment paper or grease the pan with cooking spray or butter.
Next, melt the butter. While the butter is melting, add the sugar and eggs together to the stand mixer or mixing bowl and whisk them together for a few minutes, medium-low speed, until smooth and blended together.
Then, add the melted butter to the sugar-egg mixture and whisk again for a few minutes, medium-low speed, until smooth.
And then, fold in the vanilla and the sourdough discard until completely combined.
Next, sift in the cocoa powder, flour, salt, and espresso powder. Use a spatula to gently fold everything together just until no streaks remain. Be careful not to overmix!
Fold in the chocolate chips if using and pour the batter into the baking pan. Smooth the top and bake for 22-30 minutes, or until the edges are set and a toothpick inserted into the center comes out with moist crumbs (not clean, but not a wet batter either).
Then, let the sourdough brownies cool in the pan for at least 20 minutes before slicing.