Tip: Turn off PHONE WIFI before trying to screen mirror to TV. The initial setup does work otherwise. Follow my steps below.
I connected both an S4 and S6 to a Sony Bravia. Turn on TV. Select input. Find the input which says screen mirroring. Next screen that came up asked me if I wanted a connection guide. I did nothing. Turned my phone wifi off. Then turned screen mirroring on my phone by using the swipe down motion, I did this by starting from the top of my phone and swiping down. This brings up quick links. Find the one labeled screen mirror. If you dont see it select edit on the top part of the screen to see more links. Let it scan for the Tv. It should pop up. Select it. After you see your screen mirror on the tv you can go back and turn your phone wifi on if you want. For an S4 the Tv process is the same. The phone process a little different. You still turn off phone wifi first. The mirror setting are found by go to Settings > Nearby Devices, ( toggle it on), then select screen mirroring. Tv should pop up. Select it. Then turn phone wifi on if you want.