Step 1: Run a factor analysis on the returns of all the assets that appear in your universe of interest. This step will identify how many factors are present in the returns and the factor loadings for each individual asset.
Step 2: Identify the factors. Factor analysis itself doesn't give you what factors are present in the data -- this step requires some judgement in identifying what it is that actually drives the returns.
Step 3: Make predictions about the value of the factors, then based on the factor loadings of the assets that you are interested in, predict the returns on those assets.
It's not easy to apply the APT, but the process itself is interesting and educational!
It depends on which factors you are considering for decomposing your stocks/portfolios returns.
You can consider implicit factors: factors are endogenous of your data and you have to extract them with a PCA for example. But in this case there is a lack of sense in your study because it is difficult to identify correctly the factors and moreover they are often not robust with an other sample.
But you can also consider explicit factors: explicit factors come from empirical studies like Fama & French Factors. In this case you regress return of your portfolio/stock on factors returns (Market, Size, Value, Momentum with carhart analysis) and estimate factor loadings.