The easiest way to get a game from a phone to a television is using a compatible add-on device with the TV, such as AppleTV or Chromecast. Because these devices work by design with phones, TVs and app store content, the setup is straightforward and has manufacturer support.
If the TV is connected to a network, as are many smart TVs, applications are available to stream across the network. For example, Moonlight Game Streaming streams from an Android device to a networked TV. Other programs, such as Reflector, allow a PC or Mac to act as an intermediary to stream from a device to a TV over a home network.
Another option is to connect the phone directly to the TV, such as with Apple's AV adapter. The drawback to this type of direct connection is that the device is not convenient to use as a phone. There are third-party adapters that connect an iPhone to a TV through the lightning or USB port, but they do not have a port for an additional charging cable, so battery drain is an issue. On Android, a USB to HDMI cable provides the same type of direct connection. Many Android devices have a separate charging port, so the USB connection does not prevent battery charging.