Turn on the oven to 375 degrees and set a rack on the lowest level; if there’s a second rack, remove it. Mix together the pepper, oregano, cumin and ½ teaspoon salt (1 teaspoon if your chicken is neither Kosher nor brined). (For the freshest taste, I like to start with whole spices and grind them in an electric spice grinder or mortar and pestle just before using.) Pat the chicken dry with paper towels and rub a generous couple of teaspoons of the spice mixture all over it.
Pour half of the can (¾ cup) of your beer into a measuring cup. Use a can opener to cut the top off the can. Drop one of the garlic head halves and ½ teaspoon of the spice mixture into the can with the remaining the beer. Stand the can in the center of a 13 X 9-inch baking dish and fit the chicken over it, nestling the can firmly into the chicken’s cavity. (The bird will be “standing” upright over the can.) If you’re using the vegetables, toss them with the oil, sprinkle them with salt and scatter them evenly around the chicken. Slide the chicken into the oven to roast for 1 hour, occasionally stirring the vegetables (if using).
Meanwhile, make the beer glaze: In a small (2-quart) saucepan, combine the ¾ cup of beer with the remaining spice mixture, the other garlic half, the chile flakes and the piloncillo or brown sugar. Set over medium heat and simmer, stirring frequently, until the sauce is reduced and syrupy, about 30 minutes.
When the chicken’s hour is up, check its temperature—a thermometer inserted into the thigh should read about 145 degrees. Brush the beer glaze all over the chicken and slide it back into the oven to roast until it’s golden and an instant-read thermometer inserted into the same spot reads 155 to 160 degrees, about 15 minutes more.
Remove the chicken to a cutting board and carefully lift it off the beer can (the chicken—and can—will be hot, so use tongs). Tent the bird loosely with foil and let it rest for 5 to 10 minutes. Meanwhile, if you’ve roasted vegetables, pour the contents of the can (minus the garlic) into the roasting pan, toss with the vegetables and slide into the oven to cook until they’re fully tender and most of the liquid has evaporated, about 10 minutes.
Cut the chicken into quarters and transfer a portion to each of four warm dinner plates (along with the vegetables if you have them). Dinner’s ready.