Some of the cases in the early episodes of CSI are based on true events but now its a 50/50 the the cases are but not real such as the episodes with the miniature killer are based off of BTK and other killers that left clues for the cops and CSI teams. Hope that helps.
Possibly inspired by some real life cases with some added twists and turns and combinations of different sets of things to make it more exciting. All in all. It really is possible. For it to be based on real cases
i happen to know that most of the shows have a room of writers that in many cases experts in the field. a series of ideas are bantered and then the writing begins (with the aid of the expert). of course that includes actual stories as you can usually plainly see (sometimes very current as well)