Karl Anderson, 29, smiled as he was sentenced to 16 weeks after he pleaded guilty to racially aggravated common assault at Manchester and Salford Magistrates' Court on Wednesday.
The court heard that he had kicked and shouted racial abuse at the 23-year-old midfielder outside City's training ground on Clayton Lane, Manchester, ahead of the game against Tottenham Hotspur on Saturday.
The court was shown CCTV of Anderson, who has a history of football-related violence, driving his van alongside Sterling's vehicle as the player waited to enter the training ground on Saturday.
Both men then got out of their vehicles and Anderson walked towards Sterling.
Carl Miles, prosecuting, said Anderson, who had been in the vehicle with his partner, began shouting racial abuse at Sterling and called him "you black Scouse c***".
He said Anderson also told the footballer: "I hope your mother and child wake up dead in the morning you n*****."
Mr Miles said: "He sets out kicking Mr Sterling to the legs on four occasions."
The court heard Sterling's left hamstring was sore after the attack but he did not suffer serious injuries.
In a victim personal statement, which was read to the court, the footballer said he had been "completely shocked" by the incident.
He said: "I didn't think this type of behaviour still happened in this country in this day and age."
Sentencing, chairman of the bench Diana Webb-Hobson said: "This was an entirely unprovoked attack. You stopped your car and you got out.
"The personal statement was very moving, we find injury was sustained.
"Your previous record was appalling, you don't seem to learn anything, do you?"
The court heard Anderson had 25 previous convictions for 37 offences, including throwing a flare at a police officer during a football match.
Mr Miles said he was subject to a football-related violence banning order which prevented him from attending certain matches.
He said: "He is now finding alternative ways to express violence and aggression, all relating to football."
John Black, defending, said Anderson, of Woodward Street in Ancoats, Manchester, had lost his temper with Sterling after his girlfriend asked him to ask him for an autograph.
He said: "He apologises through me to Mr Sterling for his actions."
He said the defendant could not explain his actions and "bitterly" regretted them.