In an attempt to classify groups of order $2015 = 5 \cdot 13 \cdot 31$, I deduced that only $\mathbb{Z}/2015 \mathbb{Z}$ was the only such group. I then checked with some sources that informed me that there are two groups of order 2015 (up to isomorphism) so I was wondering what the flaw in my proof is. I approached the problem as follows:
Let $G$ be a group of order 2015. It is easy to apply Sylow's theorems to show that the Sylow-13 and the Sylow-31 subgroups are normal in $G$; so let $P_{13}$ and $P_{31}$ denote the Sylow-13 and Sylow-31 subgroups, respectively. Also let $P_{5}$ denote a Sylow-5 subgroup.
Since $P_{31}$ is normal, $P_{31}P_{5}$ is a subgroup of order $5 \cdot 31$ in $G$. Now since $P_{13}$ is normal, we have that $P_{13} (P_{31} P_{5})$ is a subgroup of order $13 \cdot 31 \cdot 5$ in $G$; hence $G = P_{13} (P_{31} P_{5})$. Thus since $P_{13} \cap (P_{31} P_{5}) = \{ e\}$, $P_{13}$ is normal, and $G = P_{13} (P_{31} P_{5})$, we have that $G = P_{13} \rtimes_{\theta} P_{31}P_{5}$. Now since $\operatorname{Aut}(P_{13}) \cong \mathbb{Z} /12 \mathbb{Z} $ and $|P_{31} P_{5}|$ is relatively prime to 12, $\theta : P_{31} P_{5} \rightarrow \operatorname{Aut}(P_{13})$ must be trivial. Hence $G = P_{13} \times P_{31} P_{5}$.
Now I assumed since $P_{5}$ and $P_{31}$ are both cyclic there product would be as well, but I am guessing this is where the flaw in my proof is. This is further supported by the fact that there is two groups of order 155. How can I see that there are two possibilities for $P_{5}P_{31}$ and conclude that there are only two groups of order 2015?
I believe your argument is correct, except for the flaw that you detected yourself.
Let $H$ be a group of order 155. Then there is only one Sylow 31-group $Q_{31}$ which is hence normal. If $Q_5$ is a normal Sylow 5-group, we have again $H = Q_5 Q_{31}$, and in fact we have $H = Q_{31} \rtimes_\theta Q_5$ for some action $\theta$ of $Q_5$ on $Q_{31}$. Now, as opposed to your situation above, we have that $5$ does divide $30$, where $\operatorname{Aut}(Q_{31}) \cong \mathbb Z/30\mathbb Z$. Thus, we have to find the morphisms $\mathbb Z / 5 \mathbb Z \to \mathbb Z / 30 \mathbb Z$. They are either trivial or map $1$ to any element of order $5$, and are determined by that.
If the morphism is trivial, we end up with the direct product and an abelian group. Otherwise, let $\theta, \chi$ be two actions, and we claim that the resulting groups are isomorphic. Indeed, note that the elements of $\mathbb Z / 30 \mathbb Z$ of order $5$ are $6,12,18,24$ and form the unique Sylow $5$-group in $\mathbb Z / 30 \mathbb Z$. By isomorphically relabeling the elements of $Q_{31}$ except the identity (applying $\chi$ and $\theta$ to $Q_{31}$ and writing the results on top of each other and reading e.g. top-down), we can thus transform any such element to another. This procedure yields the desired group isomorphism of semi-direct products.