There are two different ways Twitch viewers are counted. One is the Viewer count and the other is the Viewer List. Viewer count is the number of other Twitch users who are actively viewing your channel at any given time.
In order to be counted as a twitch viewer, they must be watching your Twitch channel at the moment. As soon as someone disconnects from your channel, they are no longer counted as a viewer.
The viewer list is the list of Twitch users who have at some point or another been connected to your chat. The viewer list is more comprehensive than the viewer count.