For Macs, they'll usually repair it. There's an unwritten policy that after 3 major repairs, you can request a new Mac, but it's not a guarantee theyll do that. If they do, it'll be a new Mac.
With a few exceptions, they don't repair iPods, iPads or iPhones - they give you a warranty replacement. That may either be new or refurbed. Refurbs come in a new exterior shell with a new battery, so you shouldn't be able to visibly tell if it's new or not. Sometimes you can tell by the serial number.