Yes you can donate your car even if the car is no longer running or even if the car is running but badly.
Even if the engine or transmission are no longer working in the car you can still donate the car to a donation car charity and get a tax write off on your taxes.
If the car is non running it may sometimes be sold to someone who wants to fix it or use it for parts or the car will be sold for scrap metal and be recycled.
The car donation company will come to your house and pick up the car and give you a tax write off form which will show you how much value the car you donated is to them.
Then you can write the donation off as a tax deduction which will save you money on your taxes.
It's usually a lot better to donate your car to a charity and get a tax write off than it is to sell it for scrap metal.