In theory yes, you can restart after "retiring" from a Grand Prix but the way the rules are nowadays it is pretty unlikely.
For example, in the 1970-90s teams brought 3 cars to each race, one for each driver and a spare or "T" car. If a driver retired at the start he could jump into the spare car in case the race was restarted etc.
Here's the current rule regards spare cars: (by "competitor" they mean "team")
Each competitor may have no more than two cars available for use at
any one time during an Event. Article 23.1 of the 2018 FIA Sporting
Regulations Teams may have no more than two cars available for use at
any one time. Spare cars are not allowed
So if you have to retire your car nowadays due to a technical fault, it usually means you have to abandon the car on the track and walk back to the pits.
The rules were changed largely as a cost saving measure, back in 2008.
The last famous event involving a spare car I can remember off the top of my head was James Hunt winning the 1976 British Grand Prix although he didn't actually use the spare car, but other drivers did:
There are some other incidents of note, Hamilton rejoined the 2007 European Grand Prix after being lifted back onto the track by a crane:
It happens from time to time that a car with a mechanical problem returns to the pits and the mechanics fix the car for the driver to rejoin, usually several laps down and out of contention.
In the really old days, 1950s etc, the lead driver of a team would often take their team-mates car if theirs developed a fault or broke down.