Under the repair tab, you'll see when the next engine restock is.
You can't earn any for free except for when they get restocked (the supplier will only top you off to a max of 20, if you have more than 20 engines, they will not stock additional engines to your count).
For parts, one of your headquarter buildings will determine how many parts you will get after each race. In the app, you can earn up to 10 free parts a day by watching adds.