During the upgrade process you can fail your first checkride. Then you retrain (usually the next day) and take another checkride. If you fail that, you are sent back to the line as an F/O for 6 months. You can then bid on any captain vacancies after 6 months. If you fail your next two checkrides you are done.
This happened to my sim partner in upgrade. He opted to go back to the line on his first attempt, after not getting recommended for the checkride. On the second time though (with me) he pinked twice.
11.C.3
b. A pilot who fails his second checkride on his first attempt to qualify will return to his former position, if available. If unavailable, he will return by seniority to a position for which he is or has been qualified. If there is no such position, he will exercise his seniority to obtain any position systemwide. The pilot will not be allowed to bid another vacancy requiring training for a period of six (6) months. If he is unable to obtain any position by the process above, he will be given additional training and a third checkride. Failure of the third checkride will be dealt with at Company discretion.
c. Pilots withdrawing voluntarily from training at any time will be returned to the line in accordance with paragraph b., above.
d. The Company may elect not to treat a withdrawal for personal hardship reasons as an attempt to qualify.
e. Pilots entering training for a second attempt must demonstrate the required proficiency after completing training for the second time. Pilots demonstrating the required proficiency upon completion of training will be given at least two (2) opportunities to pass the proficiency check. A pilot who fails to qualify on his second attempt may be dealt with at Company discretion.