You would use both HDMI and optical by connecting the former to a TV and the latter to a receiver that doesn't have an HDMI input so that you could play the audio through your stereo system.
You can use the HDMI alone, typically directly to the TV or through an A/V receiver, as HDMI does carry both video and sound.
For the year prior to the disastrous 4.4 updates a couple of weeks ago, you could use optical alone to add AirPlay music capabilities to your stereo system, so that you could stream music from iTunes and devices like the Touch and iPhone to your stereo. The 4.4 update broke that capability, requiring the use of HDMI for no reason. Lots and lots of people have been complaining about that bug, as it effectively bricks the Apple TV for anyone who bought it for this purpose but can't use the HDMI connection.