Heat oven to 350°F. Grease and flour three 8-inch or two 9-inch round cake pans (or spray with baking spray); line bottoms of pans with parchment paper.
In a large bowl, whisk together flour, sugar, baking soda, cinnamon, ginger, nutmeg, allspice and salt until well-combined. Set aside.
In a small saucepan over medium heat, melt butter. Whisk butter constantly as it melts, then continue to whisk as it begins to foam, then turns a deep golden brown, about 5 minutes. Remove from heat; set aside to cool slightly.
In a separate large bowl using an electric hand mixer or in the bowl of a stand mixer with the paddle attachment, beat eggs on high speed until pale and frothy, about 3 minutes. Reduce speed to medium; drizzle in vegetable oil until just combined, then carefully drizzle brown butter into egg mixture, followed by vanilla.
Gradually stir in dry ingredients until just combined, either on low speed with a mixer or by hand with a spatula (do not overmix). Fold in carrots and raisins, if desired.
Divide batter evenly between prepared cake pans, using a spatula to spread and smooth batter if needed. Bake cakes on center rack of oven 25 to 35 minutes, until cake tops are golden brown and a toothpick inserted in the center of each cake comes out clean. Cool cakes completely in cake pans on a cooling rack.
Place one fully cooled cake on top of a cake plate/stand. Top with frosting (1 cup for a 3-layer cake; 1 1/4 cups for a 2-layer cake). Top with second cake layer, then frost top again (with same ratios). Top with third cake layer, if using, then frost top and sides of cake as desired.
Store cake covered in refrigerator for up to 5 days; bring to room temperature before serving.