Is the blackwidow Elite from razor compatible with the ps4, so also for gaming, if so, will it also be compatible with the ps5 with all the trimmings?
Yes, you just won't be able to control the lighting and you won't be able to use macro buttons.
Every keyboard is compatible with the NEXT GEN, but the games must support mouse and keyboard and the Playstation is known for the fact that it has very few games with mouse and keyboard support.
If you want to gamble on the mouse and keyboard, get a PC.