Prick each bratwurst several times with a fork to prevent them from exploding during cooking.
In a large pot or deep skillet, melt butter over medium heat. Add sliced onions and cook until softened and translucent, about 5 minutes.
Add minced garlic and caraway seeds (if using) and cook for another 30 seconds until fragrant.
Pour in the beer and bring to a gentle simmer. Carefully add the bratwurst to the simmering liquid.
Reduce heat to low, cover the pot, and simmer for 15-20 minutes, turning the brats occasionally.
While the brats are simmering, preheat your grill to medium heat (about 350°F).
Remove the bratwurst from the beer bath with tongs and transfer them to the grill.
Grill the brats for 2-3 minutes per side, or until they develop a nice brown color and grill marks.
Meanwhile, continue simmering the onions and beer mixture until slightly reduced.
Serve the grilled bratwursts on buns, topped with the beer-simmered onions and your choice of condiments.