Let $(X_i,T_i), i \in \Bbb N$, be a countably infinite family of topological spaces. Prove that $\prod^{\infty}_{i=1} (X_i,T_i)$ is a discrete space iff each $(X_i, T_1)$ is discrete and all but a finite number of the $X_i, i \in \Bbb N$ are singleton sets.
What I don't understand is: How can $\prod^{\infty}_{i=1} (X_i,T_i)$ ever be a discrete space?
A space is a discrete space iff every subset of the space is open.
So for this countably infinite product space that would mean $\prod^{\infty}_{i=1}\{a_i\}$ is open in $\prod^{\infty}_{i=1} (X_i,T_i)$, but an open set in a countably infinite product space is defined as $U = \{\prod ^{\infty}_{i=1}O_i : O_i \in T_i$ and $O_i = X_i$ for all but a finite number of $i \}$.
As an example the book gives: $U = O_1 \times O_2 \times ... \times O_n \times X_{n+1} \times X_{n+2} \times ...$.
Could someone explain to me what I am not understanding?
You have almost done. You write that a bases of the topology is made of the sets $$ U = O_1 \times O_2 \times ... \times O_n \times X_{n+1} \times X_{n+2} \times ... $$ Now you have to remember your hypothesis:
and all but a finite number of the $X_i, i \in \Bbb N$ are singleton sets.
So, there exists $N$ such that, for $i\geq N$, $X_i=\{a_i\}$. Therefore, a basis of the product topology is given by the sets
$$ U = O_1 \times O_2 \times ... \times O_{N-1} \times \{a_{N}\} \times \{a_{N+1}\} \times ... $$ where $O_1,\ldots, O_{N-1}$ are arbitrary subsets of $X_1,\ldots, X_{N-1}$. Making unions of these elements you obtain arbitrary subsets of: $\;\prod^{\infty}_{i=1} X_i=\left(\prod^{N-1}_{i=1}X_i\right)\times \left(\prod^{\infty}_{i=N}\{a_i\}\right)$.