CC company is partnered with an airline (or hotel, etc)
CC puts miles/points in your airline accout and then you spend those miles/points thru the airline to get travel
Miles may or may not expire - that's program dependant. Most keep the miles active as long as you keep the account active (such as via periodic spending on the CC).