In a medium saucepan, combine sugar, cocoa powder, milk, and butter. Stir to incorporate.
Place over medium heat and stir continuously as the mixture warms.
Bring the mixture to a full boil, then stop stirring.
Let the mixture boil undisturbed for 5 minutes.
Remove pan from heat.
Stir in vanilla extract and chocolate chips until smooth and melted.
Fold in chopped nuts if using.
Pour fudge into a greased or lined 8×8-inch pan and spread evenly.
Cool at room temperature until fully firm.
Slice into squares once set.