It can be several thing. We need some background so we can help you.
Year, engine, and trans would be a helpful start.
To be general about it,
A no start or fouled start can come from emissions, fuel delivery, or even ignition.
From there it pretty much goes down hill. Since you stated it does try to start or you've actually got it going is good.
But with no specific info the answers you'll receive will be across the board and general at best.
ie. the 525 came with 2 powerplants: M20 and M50. Both are different animals but both are linear so some diagnosis would cover both. However when you get into ignition systems they use different components.
That said, again we need more info.
Content Writer - FCPEURO
95 e34 525 5 spd S52 Swap...Sold
01 e38 740i msport (under restoration )