How to determine the lag length $q$ in the ARCH-LM test?
If I set $q=1$, the result is homoscedastic (failed to reject H0).
But if I set $q=4$ for example, the result is heteroskedastic (reject H0).
Which one should I use?
The ARCH-LM test is a portmanteau test. It tests a number of lags (lag 1 through lag $q$) at once as a group and tells you whether the average ARCH effect within the group is large. The maximum lag $q$ governs the tradeoff between power and generality:
If you have a small group of lags, you will have good power against any individual lag within the group, because the average will be relatively sensitive to each individual. If there is a substantial ARCH effect among them, the test statistic will pick that up.
However, a small group means that you might miss a lag with substantial ARCH effect that is outside the group, unlike in the case of large $q$.
If you have a large group, you will have low power against any individual lag within the group, because the average will be relatively insensitive to each individual. If there is a substantial ARCH effect in the group, the test statistic might not pick that up because all the other lags without ARCH effects would swamp the one with the ARCH effect. But at least you cover a large group and do not ignore the higher order lags altogether as in the small $q$ case.
In general, lag length selection can be motivated by subject-matter knowledge. You should check the lags where you could plausibly expect ARCH effects. You do not need to check too distant lags where ARCH effects in a given sample could mainly be due to chance.
You could try a few different lag lenghts to better elicit possible ARCH effects.
Diagnostic plots of autocorrelations and partial autocorrelations of squared residuals could also be useful.