Heat the oven to 375 degrees F and arrange a rack in the middle.
Mix together salt and pepper in a small bowl and set aside. Pat chicken dry and rub all over with 1 of the garlic heads. Rub all over (under skin too) with oil and season with salt and pepper. Place 1 garlic head and 1 lemon half in the chicken cavity.
Arrange remaining garlic, lemon, and onion on the bottom of a 3 to 4-quart baking dish to create a bed. Place chicken on top, add broth to baking dish, and cover tightly with foil. Roast until chicken reaches 135 to 140 degrees F on an instant-read thermometer, about 1 hour.
Remove foil, brush chicken with pan juices, and increase oven temperature to 450 degrees F. Roast, basting occasionally, until temperature of chicken on inner thigh is 165 degrees F, skin is golden brown, and juices run clear, about 30 to 40 minutes more.
Let rest 10 minutes before carving. Meanwhile, pour pan juices into a small saucepan and simmer over medium heat until thickened, about 7 to 10 minutes. Taste and adjust seasoning, as desired. Carve chicken and serve each portion with 1 head of garlic and pan sauce.