That pretty much depends on two things:
- the area you're living in
- the manufacturer's fairness/good will
For 1., inside the EU there's a ruling that, put simple, "software changes" such as root won't void your hardware warranty. You might lose "support" concerning software things, but if some hardware component shows problems (e.g. your battery starts acting weird, or your headphone connector fails to work) that will still be under warranty.
For 2., many manufacturers tend to "ignore" the fact your device is rooted – either generally, or because they simply "didn't notice". I just got my rooted device returned with a new image flashed, so root was gone – but no bill, the paper stated something like "repair done under warranty". You can't rely on this, but it often is handled that way.
If, however, a defect is obviously (or likely) caused by your tempering, things may look different. Say you "burned" your CPU by overclocking, a repair under warranty might be refused – for good reasons ;)