since this is not the technician link of the site, i'm assuming people addressing issues here are not technical and do not necessarily possess the training to be able to test electricical components safely. i think it's important to make the distinction here. only qualified people should be doing this type of testing.
you said sometimes the unit would come on, but not the fan. this would indicate that the contactor energizes, but the fan fails. you bought a motor and someone told you the capacitor was ok. if a motor fails, always replace the capacitor as well. i'm not sure who is advising, but you're back to square one. see what size capacitor the motor requires and replace it. if it still doesn't work, call a tehnician.
one more note. if a unit is equipped with a dual capacitor with 3 terminals, it has a 3 wire motor. if the motor is replaced with a shelf motor, it will be a 4 wire motor. without experience, it would be very easy to make a mistake in rewiring. it is possible this is the problem.