I would like to know how Dickey fuller test works. Is there some pseudo code I can study? Is there source code that I can read to understand the dickey fuller test in detail to understand how it works. I am really confused on how the Dickey Fuller test / Augmented Dickey Fuller tests work. Some help would be really appreciated. 
 A: You can for example take a look at the implementation of the urca package by typing
library(urca)
ur.df

A: I have been in the same situation as yours. 


*

*As mentioned in the comments, DF or ADF works by doing a linear regression, estimated by OLS. Technically, you can do this by yourself, say using lm function in R. However, the p-values reported by this would not be appropriate as you need DF table. This table is easily available in many texts, e.g. Hamilton's Time Series Analysis. For more see this.

*Coming to how softwares do it: Let me take R as an example: there are many packages in R that provide ADF test: tseries::adf.test, aTSA::adf.test, fUnitRoots::adfTest, and finally urca::ur.df
All provide options to choose drift, trend, lags etc. However, only ur.df provides summary of the regression being done in the background. Good thing is that the summary of regression allows you to know what parameters are insignificant. This is extremely important if you mis-specify the ADF test. For example, if you include trend and the original process is stationary with no time trend then it may report the series to be non-stationary (I have had this problem in aTSA::adf.test).


*Finally, the last resort is to see the source code. This is easy in rstudio. In rstudio's Console panel or Source panel, write the function and then press F2. It opens up the source code. Hope this helps.

