There are several methods this can be done.
Traditionally tanks had sensor probes that contained float switches. You would have a different switch at a different depth - easy.
However it does not tell you how much 'stuff you have in your tank'
For a liquid in a tank pressure sensors are used. these sit just off the bottom of the tank and provide an indication of the mass of fluid above them
However it is also possible to use an ultrasonic or laser measure to measure the fluid level from the TOP of the tank.
All of these sensors will give you an analogue reading, either a current or voltage change in relation to the tank 'level'. (of cause you can buy a digital sensor but this does the software job you are trying to do and probably doesn't do it that well in my experience).
Once you have your analogue readings into your RPi then the fun begins.
1) You will need a reading for full, and another for empty (and need to ensure that neither of these go beyond the maximum or minimum limits of your ADC)
2) any reading you get will not be linear. the tank will not always be uniform shape, and the sensor will not always give a linear deflection.
3) you will have to handle 'slosh' especially if the tank moving (in a vehicle for example)
You could always use a flow meter to record how much fluid goes into the tank and another on the output. the difference between the two is the volume you have in your tank,,,
4) what about losses such as leeks and evaporation?
5) measurement accuracy, over time slight differences between the two sensors will lead to the tank becoming empty or overflowing
How about measuring the weight of the tank and its contents?
Strain gauges are good for this
6) but weight changes with air pressure
And finally volume changes with temperature....
however whilst everything I have said is correct, these inaccuracies may not have any effect on your system because they may be 'acceptable' for your case.
I hope that this has given you some ideas of where to go and some of the issues to consider